Commit 738f22d0 authored by 陈子龙's avatar 陈子龙

自动化运维 立即执行 fix

parent d800e0a8
......@@ -263,7 +263,7 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
outputBuf := bufio.NewReader(stdout)
readerr := bufio.NewReader(stderr)
var out, outErr, errFlag int
var out, outErr int
var execLog string
for {
......@@ -286,7 +286,6 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
outErr = 1
} else if outErr == 0 {
//存储异常执行日志
errFlag = 1
execLog = execLog + lineErr + " \n "
UpdateExecHistory(request.UpdateExecHistory{
TaskHistoryId: id,
......@@ -295,25 +294,25 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
}
if out == 1 && outErr == 1 {
if errFlag == 1 {
//任务执行失败
UpdateExecHistory(request.UpdateExecHistory{
TaskHistoryId: id,
ExecLog: execLog,
State: 2,
})
} else {
//任务执行成功
UpdateExecHistory(request.UpdateExecHistory{
TaskHistoryId: id,
ExecLog: execLog,
State: 1,
})
}
break
}
}
cmd.Wait()
if cmd.ProcessState.Success() {
//任务执行成功
UpdateExecHistory(request.UpdateExecHistory{
TaskHistoryId: id,
ExecLog: execLog,
State: 1,
})
} else {
//任务执行失败
UpdateExecHistory(request.UpdateExecHistory{
TaskHistoryId: id,
ExecLog: execLog,
State: 2,
})
}
return
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment