Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
537008ee
Commit
537008ee
authored
Jul 17, 2023
by
陈子龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-czl' into dev
parents
09afcbb6
e4f92f55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
25 deletions
+4
-25
src/service/task_manage.go
src/service/task_manage.go
+4
-25
No files found.
src/service/task_manage.go
View file @
537008ee
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment