aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-03-26 16:29:08 +0100
committerTaras Madan <tarasmadan@google.com>2025-03-27 10:07:16 +0000
commitb181c36d588da8d6007a23c0ad7305893758cec5 (patch)
tree610856168965d1f7c9ed219327c507ce46f5e22c /vm/vmimpl
parentf2f5b9669a4d459e13b12f9e7616ca3c5ddb26e0 (diff)
vm: use SSHOptions instead of 4 params
It reduces WaitForSSH parameter count from 9 to 6.
Diffstat (limited to 'vm/vmimpl')
-rw-r--r--vm/vmimpl/util.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/vm/vmimpl/util.go b/vm/vmimpl/util.go
index a04914e6d..2df514ac6 100644
--- a/vm/vmimpl/util.go
+++ b/vm/vmimpl/util.go
@@ -23,8 +23,14 @@ func SleepInterruptible(d time.Duration) bool {
}
}
-func WaitForSSH(debug bool, timeout time.Duration, addr, sshKey, sshUser, OS string, port int, stop chan error,
- systemSSHCfg bool) error {
+type SSHOptions struct {
+ Addr string
+ Port int
+ User string
+ Key string
+}
+
+func WaitForSSH(timeout time.Duration, opts SSHOptions, OS string, stop chan error, systemSSHCfg, debug bool) error {
pwd := "pwd"
if OS == targets.Windows {
pwd = "dir"
@@ -39,7 +45,7 @@ func WaitForSSH(debug bool, timeout time.Duration, addr, sshKey, sshUser, OS str
case <-Shutdown:
return fmt.Errorf("shutdown in progress")
}
- args := append(SSHArgs(debug, sshKey, port, systemSSHCfg), sshUser+"@"+addr, pwd)
+ args := append(SSHArgs(debug, opts.Key, opts.Port, systemSSHCfg), opts.User+"@"+opts.Addr, pwd)
if debug {
log.Logf(0, "running ssh: %#v", args)
}