Refactor SSHExternal flag so it isn't quietly ignored on Windows

This commit is contained in:
Oliver Bristow
2016-11-14 00:55:33 +00:00
parent 6d82ad32a9
commit f648b5ad0a
3 changed files with 12 additions and 8 deletions

View File

@@ -26,7 +26,6 @@ import (
"net"
"os"
"os/exec"
"runtime"
"strings"
"syscall"
"time"
@@ -150,10 +149,10 @@ func parallelSSHExec(fn func(osTypeInterface) error, timeoutSec ...int) (errs []
}
func sshExec(c conf.ServerInfo, cmd string, sudo bool, log ...*logrus.Entry) (result sshResult) {
if isSSHExecNative() {
result = sshExecNative(c, cmd, sudo)
} else {
if conf.Conf.SSHExternal {
result = sshExecExternal(c, cmd, sudo)
} else {
result = sshExecNative(c, cmd, sudo)
}
logger := getSSHLogger(log...)
@@ -161,10 +160,6 @@ func sshExec(c conf.ServerInfo, cmd string, sudo bool, log ...*logrus.Entry) (re
return
}
func isSSHExecNative() bool {
return runtime.GOOS == "windows" || !conf.Conf.SSHExternal
}
func sshExecNative(c conf.ServerInfo, cmd string, sudo bool) (result sshResult) {
result.Servername = c.ServerName
result.Host = c.Host