Implements file except handler for patchsets 51/38151/2
authorlhinds <lhinds@redhat.com>
Wed, 26 Jul 2017 09:13:03 +0000 (10:13 +0100)
committerlhinds <lhinds@redhat.com>
Wed, 26 Jul 2017 09:16:36 +0000 (10:16 +0100)
Simple try / except handler in the event that an edge case occurs
and a patchset is not present.

Change-Id: Ica5df2f5b37fff98c52f79bd2a8e47ba46890e80
Signed-off-by: lhinds <lhinds@redhat.com>
anteater/src/patch_scan.py

index 1deb68f..873c069 100644 (file)
@@ -55,8 +55,12 @@ def prepare_patchset(project, patchset):
     licence_ignore = lists.licence_ignore()
 
     # Open patch set to get file list
-    fo = open(patchset, 'r')
-    lines = fo.readlines()
+    try:
+        fo = open(patchset, 'r')
+        lines = fo.readlines()
+    except IOError:
+        logger.error('%s does not exist', patchset)
+        sys.exit(1)
 
     for line in lines:
         patch_file = line.strip('\n')