Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Eric Zheng
slapos.toolbox
Commits
5698a3fb
Commit
5698a3fb
authored
Oct 26, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notifier.py: new argument allowing to run the executable several times in case of failure
parent
cc34cbb2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
21 deletions
+31
-21
slapos/pubsub/notifier.py
slapos/pubsub/notifier.py
+31
-21
No files found.
slapos/pubsub/notifier.py
View file @
5698a3fb
...
@@ -48,6 +48,9 @@ def main():
...
@@ -48,6 +48,9 @@ def main():
parser
.
add_argument
(
'--transaction-id'
,
nargs
=
1
,
dest
=
'transaction_id'
,
parser
.
add_argument
(
'--transaction-id'
,
nargs
=
1
,
dest
=
'transaction_id'
,
type
=
int
,
required
=
False
,
type
=
int
,
required
=
False
,
help
=
"Additional parameter for notification-url"
)
help
=
"Additional parameter for notification-url"
)
parser
.
add_argument
(
'--max-run'
,
dest
=
'max_run'
,
type
=
int
,
default
=
1
,
required
=
False
,
help
=
"Run executable until it ends correctly, in a limit of max-run times"
)
# Verbose mode
# Verbose mode
parser
.
add_argument
(
'--instance-root-name'
,
dest
=
'instance_root_name'
,
parser
.
add_argument
(
'--instance-root-name'
,
dest
=
'instance_root_name'
,
...
@@ -74,6 +77,11 @@ def main():
...
@@ -74,6 +77,11 @@ def main():
saveStatus
(
'STARTED'
)
saveStatus
(
'STARTED'
)
if
args
.
max_run
<=
0
:
print
"--max-run argument takes a strictely positive number as argument"
sys
.
exit
(
-
1
)
while
args
.
max_run
>
0
:
try
:
try
:
content
=
subprocess
.
check_output
(
content
=
subprocess
.
check_output
(
args
.
executable
[
0
],
args
.
executable
[
0
],
...
@@ -86,7 +94,9 @@ def main():
...
@@ -86,7 +94,9 @@ def main():
content
.
replace
(
'&'
,
'&'
).
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
)
content
.
replace
(
'&'
,
'&'
).
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
)
))
))
saveStatus
(
'FINISHED'
)
saveStatus
(
'FINISHED'
)
break
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
args
.
max_run
-=
1
saveStatus
(
'ERROR'
)
saveStatus
(
'ERROR'
)
content
=
e
.
output
content
=
e
.
output
exit_code
=
e
.
returncode
exit_code
=
e
.
returncode
...
...
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