Commit 5698a3fb authored by Nicolas Wavrant's avatar Nicolas Wavrant

notifier.py: new argument allowing to run the executable several times in case of failure

parent cc34cbb2
Pipeline #3068 skipped
......@@ -48,6 +48,9 @@ def main():
parser.add_argument('--transaction-id', nargs=1, dest='transaction_id',
type=int, required=False,
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
parser.add_argument('--instance-root-name', dest='instance_root_name',
......@@ -74,6 +77,11 @@ def main():
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:
content = subprocess.check_output(
args.executable[0],
......@@ -86,7 +94,9 @@ def main():
content.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
))
saveStatus('FINISHED')
break
except subprocess.CalledProcessError as e:
args.max_run -= 1
saveStatus('ERROR')
content = e.output
exit_code = e.returncode
......
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