节点离线时尝试自动通过API节点远程启动

This commit is contained in:
刘祥超
2022-09-17 10:18:00 +08:00
parent 5b0adb4b84
commit ee2c253e7d
8 changed files with 89 additions and 620 deletions

View File

@@ -42,10 +42,10 @@ func (this *BaseInstaller) Login(credentials *Credentials) error {
}
// 认证
methods := []ssh.AuthMethod{}
var methods = []ssh.AuthMethod{}
if credentials.Method == "user" {
{
authMethod := ssh.Password(credentials.Password)
var authMethod = ssh.Password(credentials.Password)
methods = append(methods, authMethod)
}
@@ -79,7 +79,7 @@ func (this *BaseInstaller) Login(credentials *Credentials) error {
if len(credentials.Username) == 0 {
credentials.Username = "root"
}
config := &ssh.ClientConfig{
var config = &ssh.ClientConfig{
User: credentials.Username,
Auth: methods,
HostKeyCallback: hostKeyCallback,