Commit 537008ee authored by 陈子龙's avatar 陈子龙

Merge branch 'dev-czl' into dev

parents 09afcbb6 e4f92f55
......@@ -395,7 +395,6 @@ func ExecAnsible(id, taskId int, value string) {
zap.L().Error(err.Error())
}
for {
//逐行输出日志
lineOut, err1 := outputBuf.ReadString('\n')
if (err1 != nil || io.EOF == err1) && out == 0 {
......@@ -403,19 +402,10 @@ func ExecAnsible(id, taskId int, value string) {
} else if out == 0 {
//存储执行日志
execLog = execLog + lineOut + " \n "
//err = UpdateExecHistory(request.UpdateExecHistory{
// TaskHistoryId: id,
// ExecLog: execLog,
//})
//if err != nil {
// conf.Logger.Error("Store Execution Log", zap.Error(err))
// //return
//}
// TODO 写缓存
// 写缓存
err = redis.HSet(conf.AutoExecHistory, strconv.Itoa(id), execLog)
if err != nil {
conf.Logger.Error("Store Execution Log", zap.Error(err))
//return
}
}
......@@ -425,22 +415,12 @@ func ExecAnsible(id, taskId int, value string) {
} else if outErr == 0 {
//存储异常执行日志
execLog = execLog + lineErr + " \n "
//err = UpdateExecHistory(request.UpdateExecHistory{
// TaskHistoryId: id,
// ExecLog: execLog,
//})
//if err != nil {
// conf.Logger.Error("Store abnormal execution logs", zap.Error(err))
// //return
//}
// TODO 写缓存
// 写缓存
err = redis.HSet(conf.AutoExecHistory, strconv.Itoa(id), execLog)
if err != nil {
conf.Logger.Error("Store Execution Log", zap.Error(err))
//return
}
}
if out == 1 && outErr == 1 {
break
}
......@@ -458,7 +438,7 @@ func ExecAnsible(id, taskId int, value string) {
conf.Logger.Error("Modify Execution Status", zap.Error(err))
//return
}
redis.Del(strconv.Itoa(id))
redis.HDel(conf.AutoExecHistory, strconv.Itoa(id))
} else {
//任务执行失败
err = UpdateExecHistory(request.UpdateExecHistory{
......@@ -470,7 +450,6 @@ func ExecAnsible(id, taskId int, value string) {
conf.Logger.Error("Modify Execution Status", zap.Error(err))
//return
}
redis.Del(strconv.Itoa(id))
redis.HDel(conf.AutoExecHistory, strconv.Itoa(id))
}
//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