"src/page/main/system-admin/menu/menu-form.vue" did not exist on "45141bf3fb977a40f2da31f2ad5f91c0a8f6cf1e"
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) { ...@@ -395,7 +395,6 @@ func ExecAnsible(id, taskId int, value string) {
zap.L().Error(err.Error()) zap.L().Error(err.Error())
} }
for { for {
//逐行输出日志 //逐行输出日志
lineOut, err1 := outputBuf.ReadString('\n') lineOut, err1 := outputBuf.ReadString('\n')
if (err1 != nil || io.EOF == err1) && out == 0 { if (err1 != nil || io.EOF == err1) && out == 0 {
...@@ -403,19 +402,10 @@ func ExecAnsible(id, taskId int, value string) { ...@@ -403,19 +402,10 @@ func ExecAnsible(id, taskId int, value string) {
} else if out == 0 { } else if out == 0 {
//存储执行日志 //存储执行日志
execLog = execLog + lineOut + " \n " 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) err = redis.HSet(conf.AutoExecHistory, strconv.Itoa(id), execLog)
if err != nil { if err != nil {
conf.Logger.Error("Store Execution Log", zap.Error(err)) conf.Logger.Error("Store Execution Log", zap.Error(err))
//return
} }
} }
...@@ -425,22 +415,12 @@ func ExecAnsible(id, taskId int, value string) { ...@@ -425,22 +415,12 @@ func ExecAnsible(id, taskId int, value string) {
} else if outErr == 0 { } else if outErr == 0 {
//存储异常执行日志 //存储异常执行日志
execLog = execLog + lineErr + " \n " 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) err = redis.HSet(conf.AutoExecHistory, strconv.Itoa(id), execLog)
if err != nil { if err != nil {
conf.Logger.Error("Store Execution Log", zap.Error(err)) conf.Logger.Error("Store Execution Log", zap.Error(err))
//return
} }
} }
if out == 1 && outErr == 1 { if out == 1 && outErr == 1 {
break break
} }
...@@ -458,7 +438,7 @@ func ExecAnsible(id, taskId int, value string) { ...@@ -458,7 +438,7 @@ func ExecAnsible(id, taskId int, value string) {
conf.Logger.Error("Modify Execution Status", zap.Error(err)) conf.Logger.Error("Modify Execution Status", zap.Error(err))
//return //return
} }
redis.Del(strconv.Itoa(id)) redis.HDel(conf.AutoExecHistory, strconv.Itoa(id))
} else { } else {
//任务执行失败 //任务执行失败
err = UpdateExecHistory(request.UpdateExecHistory{ err = UpdateExecHistory(request.UpdateExecHistory{
...@@ -470,7 +450,6 @@ func ExecAnsible(id, taskId int, value string) { ...@@ -470,7 +450,6 @@ func ExecAnsible(id, taskId int, value string) {
conf.Logger.Error("Modify Execution Status", zap.Error(err)) conf.Logger.Error("Modify Execution Status", zap.Error(err))
//return //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