aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl/util.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-09-26 15:31:32 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-10-01 14:41:08 +0000
commit1bd1bc7d21be9920a31f48d2e962dc74274d216f (patch)
tree1645860e7374ab650321089f1f884c1ed8631c0a /vm/vmimpl/util.go
parent12039a0e63377e86fa1b5adc3d327d6e07f23a32 (diff)
vm: use error wrapping to detect ssh connection errors
This is a much cleaner logic than string matching.
Diffstat (limited to 'vm/vmimpl/util.go')
-rw-r--r--vm/vmimpl/util.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm/vmimpl/util.go b/vm/vmimpl/util.go
index 729e78de6..a0e3ce841 100644
--- a/vm/vmimpl/util.go
+++ b/vm/vmimpl/util.go
@@ -58,13 +58,15 @@ func WaitForSSH(timeout time.Duration, opts SSHOptions, OS string, stop chan err
}
if time.Since(startTime) > timeout {
return &osutil.VerboseError{
- Err: fmt.Errorf("can't ssh into the instance"),
+ Err: ErrCantSSH,
Output: []byte(err.Error()),
}
}
}
}
+var ErrCantSSH = fmt.Errorf("can't ssh into the instance")
+
func SSHArgs(debug bool, sshKey string, port int, systemSSHCfg bool) []string {
return sshArgs(debug, sshKey, "-p", port, 0, systemSSHCfg)
}