From b181c36d588da8d6007a23c0ad7305893758cec5 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 26 Mar 2025 16:29:08 +0100 Subject: vm: use SSHOptions instead of 4 params It reduces WaitForSSH parameter count from 9 to 6. --- vm/vmimpl/util.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'vm/vmimpl') 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) } -- cgit mrf-deployment