mirror of
https://github.com/containers/podman.git
synced 2026-02-05 15:45:08 +01:00
Fix regression in podman machine ssh
While doing the provider obfuscation, I injected a regression where
podman ssh machine failed. The regression was added in
0f22c1c772. I have fixed the regression
and added a test to prevent future occurance.
Fixes: #27491
Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@@ -190,7 +190,7 @@ func toHumanFormat(vms []*machine.ListResponse, defaultCon *config.Connection) [
|
||||
isDefault := false
|
||||
// check port, in case we somehow have machines with the same name in different providers
|
||||
if defaultCon != nil {
|
||||
isDefault = vm.Name == defaultCon.Name && strings.Contains(defaultCon.URI, strconv.Itoa((vm.Port)))
|
||||
isDefault = vm.Name == defaultCon.Name && strings.Contains(defaultCon.URI, strconv.Itoa(vm.Port))
|
||||
}
|
||||
if isDefault {
|
||||
response.Name = vm.Name + "*"
|
||||
|
||||
@@ -60,14 +60,15 @@ func ssh(_ *cobra.Command, args []string) error {
|
||||
// it implies podman cannot read its machine files, which is bad
|
||||
mc, vmProvider, err = shim.VMExists(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if errors.Is(err, &define.ErrVMDoesNotExist{}) {
|
||||
vmName = args[0]
|
||||
} else {
|
||||
var vmNotExistsErr *define.ErrVMDoesNotExist
|
||||
if !errors.As(err, &vmNotExistsErr) {
|
||||
return err
|
||||
}
|
||||
sshOpts.Args = append(sshOpts.Args, args[0])
|
||||
} else {
|
||||
vmName = args[0]
|
||||
exists = true
|
||||
}
|
||||
exists = true
|
||||
}
|
||||
|
||||
// If len is greater than 1, it means we might have been
|
||||
|
||||
Reference in New Issue
Block a user