summaryrefslogtreecommitdiff
path: root/cmd/podman/machine/ssh.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-07-21 11:41:13 +0200
committerMatthew Heon <matthew.heon@pm.me>2022-07-26 14:24:37 -0400
commit69fcf04c69068a0610a496d479dba86d46f0901f (patch)
treef2ffbbcef31dfe3a45d6fecba81ece2e98921651 /cmd/podman/machine/ssh.go
parentce790e61b1a0a983a1900b76b1ad9864d15b1496 (diff)
downloadpodman-69fcf04c69068a0610a496d479dba86d46f0901f.tar.gz
podman-69fcf04c69068a0610a496d479dba86d46f0901f.tar.bz2
podman-69fcf04c69068a0610a496d479dba86d46f0901f.zip
fix some pkg/machine/e2e test to read stderr
Also fix the machine ssh code order to provide a better error message. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman/machine/ssh.go')
-rw-r--r--cmd/podman/machine/ssh.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index cb2f62f51..8534b8efa 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -80,6 +80,11 @@ func ssh(cmd *cobra.Command, args []string) error {
}
}
+ vm, err = provider.LoadVMByName(vmName)
+ if err != nil {
+ return fmt.Errorf("vm %s not found: %w", vmName, err)
+ }
+
if !validVM && sshOpts.Username == "" {
sshOpts.Username, err = remoteConnectionUsername()
if err != nil {
@@ -87,10 +92,6 @@ func ssh(cmd *cobra.Command, args []string) error {
}
}
- vm, err = provider.LoadVMByName(vmName)
- if err != nil {
- return fmt.Errorf("vm %s not found: %w", vmName, err)
- }
err = vm.SSH(vmName, sshOpts)
return utils.HandleOSExecError(err)
}