SSH认证支持sudo

This commit is contained in:
刘祥超
2021-12-06 19:27:11 +08:00
parent 820779e614
commit 8fd29bd81c
14 changed files with 382 additions and 130 deletions
+10
View File
@@ -94,7 +94,13 @@ func (this *BaseInstaller) Login(credentials *Credentials) error {
if err != nil {
return err
}
if credentials.Sudo {
client.Sudo(credentials.Password)
}
this.client = client
return nil
}
@@ -146,6 +152,10 @@ func (this *BaseInstaller) InstallHelper(targetDir string, role nodeconfigs.Node
return env, err
}
if len(uname) == 0 {
return nil, errors.New("unable to execute 'uname -a' on this system")
}
osName := ""
archName := ""
if strings.Contains(uname, "Darwin") {