From 0e543331f6eaefc6aa520ddda847eb5eeed2f073 Mon Sep 17 00:00:00 2001 From: ouqiang Date: Tue, 2 May 2017 15:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AESSH?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ssh/ssh.go | 2 +- service/task.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 45eb5a8..669f7f1 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -34,7 +34,7 @@ type Result struct { } func parseSSHConfig(sshConfig SSHConfig) (config *ssh.ClientConfig, err error) { - timeout := SSHConnectTimeout * time.Second + timeout := time.Duration(SSHConnectTimeout) * time.Second // 密码认证 if sshConfig.AuthType == HostPassword { config = &ssh.ClientConfig{ diff --git a/service/task.go b/service/task.go index 750156d..e6f3695 100644 --- a/service/task.go +++ b/service/task.go @@ -158,7 +158,7 @@ func (h *SSHCommandHandler) Run(taskModel models.TaskHost) (string, error) { sshConfig.User = hostModel.Username sshConfig.Host = hostModel.Name sshConfig.Port = hostModel.Port - sshConfig.ExecTimeout = 5 + sshConfig.ExecTimeout = taskModel.Timeout sshConfig.AuthType = hostModel.AuthType var password string var privateKey string @@ -204,7 +204,6 @@ func updateTaskLog(taskLogId int64, taskResult TaskResult) (int64, error) { var status models.Status var result string = taskResult.Result if taskResult.Err != nil { - result = taskResult.Err.Error() + "\n" + result status = models.Failure } else { status = models.Finish