fix: ssh args for machine init/add when using ssh+cli

This commit is contained in:
Pasha Sviderski
2026-01-28 17:44:54 +10:00
parent 87e49dfb62
commit ce46a67d6d
+7 -2
View File
@@ -30,7 +30,7 @@ func NewSSHCLIRemote(user, host string, port int, keyPath string) *SSHCLIRemote
func (r *SSHCLIRemote) buildSSHArgs() []string { func (r *SSHCLIRemote) buildSSHArgs() []string {
args := []string{"-o", "ConnectTimeout=5"} args := []string{"-o", "ConnectTimeout=5"}
if r.port != 0 && r.port != 22 { if r.port != 0 {
args = append(args, "-p", strconv.Itoa(r.port)) args = append(args, "-p", strconv.Itoa(r.port))
} }
@@ -38,7 +38,12 @@ func (r *SSHCLIRemote) buildSSHArgs() []string {
args = append(args, "-i", r.keyPath) args = append(args, "-i", r.keyPath)
} }
args = append(args, r.user+"@"+r.host) dst := r.host
if r.user != "" {
dst = fmt.Sprintf("%s@%s", r.user, dst)
}
args = append(args, dst)
return args return args
} }