TPE-180 Skip deleted SR tag processing in requests job 18/144818/1
authorhyokeun <hyokeun.jeon@samsung.com>
Fri, 18 Aug 2017 05:35:08 +0000 (14:35 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Fri, 18 Aug 2017 05:35:13 +0000 (14:35 +0900)
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

index 2e50f40..2fdfeb9 100644 (file)
@@ -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"\