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
738f22d0
Commit
738f22d0
authored
Jul 07, 2023
by
陈子龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动化运维 立即执行 fix
parent
d800e0a8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
src/service/task_manage.go
src/service/task_manage.go
+16
-17
No files found.
src/service/task_manage.go
View file @
738f22d0
...
@@ -263,7 +263,7 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
...
@@ -263,7 +263,7 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
outputBuf
:=
bufio
.
NewReader
(
stdout
)
outputBuf
:=
bufio
.
NewReader
(
stdout
)
readerr
:=
bufio
.
NewReader
(
stderr
)
readerr
:=
bufio
.
NewReader
(
stderr
)
var
out
,
outErr
,
errFlag
int
var
out
,
outErr
int
var
execLog
string
var
execLog
string
for
{
for
{
...
@@ -286,7 +286,6 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
...
@@ -286,7 +286,6 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
outErr
=
1
outErr
=
1
}
else
if
outErr
==
0
{
}
else
if
outErr
==
0
{
//存储异常执行日志
//存储异常执行日志
errFlag
=
1
execLog
=
execLog
+
lineErr
+
"
\n
"
execLog
=
execLog
+
lineErr
+
"
\n
"
UpdateExecHistory
(
request
.
UpdateExecHistory
{
UpdateExecHistory
(
request
.
UpdateExecHistory
{
TaskHistoryId
:
id
,
TaskHistoryId
:
id
,
...
@@ -295,25 +294,25 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
...
@@ -295,25 +294,25 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (err error) {
}
}
if
out
==
1
&&
outErr
==
1
{
if
out
==
1
&&
outErr
==
1
{
if
errFlag
==
1
{
break
//任务执行失败
}
}
cmd
.
Wait
()
if
cmd
.
ProcessState
.
Success
()
{
//任务执行成功
UpdateExecHistory
(
request
.
UpdateExecHistory
{
UpdateExecHistory
(
request
.
UpdateExecHistory
{
TaskHistoryId
:
id
,
TaskHistoryId
:
id
,
ExecLog
:
execLog
,
ExecLog
:
execLog
,
State
:
2
,
State
:
1
,
})
})
}
else
{
}
else
{
//任务执行成功
//任务执行失败
UpdateExecHistory
(
request
.
UpdateExecHistory
{
UpdateExecHistory
(
request
.
UpdateExecHistory
{
TaskHistoryId
:
id
,
TaskHistoryId
:
id
,
ExecLog
:
execLog
,
ExecLog
:
execLog
,
State
:
1
,
State
:
2
,
})
})
}
}
break
}
}
cmd
.
Wait
()
return
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