From 49641385b02d8cbc89ea7d2c270bc288d22e9bff Mon Sep 17 00:00:00 2001 From: hyokeun Date: Fri, 18 Aug 2017 14:35:08 +0900 Subject: [PATCH] TPE-180 Skip deleted SR tag processing in requests job Problem: If developer removed SR tag before accept/reject it, the requests job will broke due to fail to search tag info. Fix: Skip deleted tag. Change-Id: Iba6bb4f9e05a0c36eec206602545b0dbeb790cf8 --- job_request.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/job_request.py b/job_request.py index 2e50f40..2fdfeb9 100644 --- a/job_request.py +++ b/job_request.py @@ -65,7 +65,12 @@ def tag_info(prj, tag): exit(1) mygit = Git(os.path.join(os.getenv('WORKSPACE'), prj)) - return mygit.get_tag(tag) + try: + tag_data = mygit.get_tag(tag) + return mygit.get_tag(tag) + except Exception as err: + print repr(err) + return None def obs_git_data(event_fields): """Put obs and git data into a dict""" @@ -143,10 +148,11 @@ def obs_git_data(event_fields): except Exception as err: print 'Warning: not able to find package name from description' tag = tag_info(project, entry['GIT_TAG']) - tag.update({'GIT_PROJECT': project, - 'OBS_REQ_PKG_SRC': obs_req_pkg_name, - 'OBS_REQ_PKG': obs_req_pkg_name,}) - projects_list.append(tag) + if tag: + tag.update({'GIT_PROJECT': project, + 'OBS_REQ_PKG_SRC': obs_req_pkg_name, + 'OBS_REQ_PKG': obs_req_pkg_name,}) + projects_list.append(tag) else: print '-------------------------------------' print "FATAL ERROR: Invalid rquest info: the request might be"\ -- 2.7.4