Trigger post-image-creation job with failed status if imager stucked 98/89998/1
authorhyokeun <hyokeun.jeon@samsung.com>
Wed, 28 Sep 2016 04:13:50 +0000 (13:13 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Wed, 28 Sep 2016 04:28:18 +0000 (13:28 +0900)
Problem: When image creation job stucked and aborted itself, post-image-creation job will not be called.
Fix: Prepare dummy failed trigger infomation. It will always trigger remaining job.

Change-Id: I8d73ff72ffdfd77f25133ac19b7d82b0db37bcfc

job_imager.py

index d75c979..310ba97 100755 (executable)
@@ -228,6 +228,18 @@ def main():
     outdir = os.path.join(basedir, 'out')
     os.makedirs(outdir)
 
+    url = os.path.join(fields.get('url_pub_base', ''),
+                       fields['repo_path'], fields['images_path'])
+
+    # Triggering DUMMY post-image-creation
+    data = {"image_xml": "<?xml version=\"1.0\" ?>\n",
+            "name": fields['name'],
+            "project": fields.get('project', ''),
+            "status": "failed",
+            "url": url
+            }
+    trigger_next("POST-IMAGE-CREATION", data)
+
     ksf = os.path.join(outdir, '%s.ks' % name)
     with open(ksf, 'w') as ks_fh:
         ks_fh.write(fields["kickstart"])
@@ -299,9 +311,6 @@ def main():
 
     xml_string = get_xml(os.path.join(outdir, build_id), name)
 
-    url = os.path.join(fields.get('url_pub_base', ''),
-                       fields['repo_path'], fields['images_path'])
-
     # All project will trigger the post-image-creation
     # Trigger info for post image creation job
     data = {"image_xml": xml_string,