From c68238787af2cb42dacad89f0a979b32da67c457 Mon Sep 17 00:00:00 2001 From: hyokeun Date: Mon, 14 Aug 2017 10:26:38 +0900 Subject: [PATCH] TPE-167 Bugfix: Retry failed prerelease creation Retry routine was missing when submit job merge. Change-Id: Ib49c57523d9711ffe1ce418c50dc923758eae165 --- job_submit.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/job_submit.py b/job_submit.py index 9be7a47..012c04e 100644 --- a/job_submit.py +++ b/job_submit.py @@ -148,7 +148,6 @@ def enqueue_request(url, gerrit_project, git_tag, gerrit_newrev, print 'QUEUED... %s\n' % enqueue_item def process_requests(build, request_q): - fail_count = 0 for x in request_q['requests']: args = x[x.keys()[0]] @@ -158,14 +157,16 @@ def process_requests(build, request_q): a['url'] = request_q['url'] a['obs_target_prj'] = request_q['obs_target_prj'] retry_count = 3 - while retry_count > 0: - create_project(build, x.keys()[0], args, mode=request_q['reason']) - break - if not retry_count: - print 'retrying failed' - fail_count += 1 - - return fail_count + while retry_count >= 0: + try: + create_project(build, x.keys()[0], args, mode=request_q['reason']) + break + except Exception as err: + print 'create_project error: %s' % repr(err) + retry_count -= 1 + if retry_count < 0: + return -1 + return 0 def entry(option): print option @@ -187,8 +188,7 @@ def entry(option): # Split obs creation job if len(option) > 2 and option[2] == 'request': content = trigger_info(os.getenv('TRIGGER_INFO')) - process_requests(build, content) - return + return process_requests(build, content) # First store current build and all the rest queued builds build_queue = [] -- 2.7.4