check the repo status before start create repo
authorHasan Wan <hasan.wan@intel.com>
Fri, 31 May 2013 09:06:51 +0000 (17:06 +0800)
committerHasan Wan <hasan.wan@intel.com>
Wed, 5 Jun 2013 03:04:13 +0000 (11:04 +0800)
Change-Id: Iffe047b3d5a3bed7fe100c941128549dec5bcc9f
Signed-off-by: Hasan Wan <hasan.wan@intel.com>
job_pre_release_obs.py

index 53c7b82..c0f0ad4 100755 (executable)
@@ -152,6 +152,7 @@ def main(name, action):
     content = trigger_info(os.getenv("TRIGGER_INFO"))
 
     project = content.get("project")
+    build = BuildService(obs_api, obs_user, obs_passwd)
 
     if action == 'create_images':
         # Init backend database
@@ -159,9 +160,19 @@ def main(name, action):
         redis_port = os.getenv("REDIS_PORT")
         backenddb = BackendDB(redis_host, redis_port)
         repo = content.get("repo")
+
+        # Check whether all the repos published, we skip it if any one of
+        # them not published
+        repo_status = build.get_repo_state(project)
+        for target_arch, status in repo_status.items():
+            if target_arch.split('/')[0] == repo and status != 'published':
+                print "The project: %s target: %s repo doesn't published yet" \
+                    %(project, target_arch)
+
+                return True
+
         make_repo(project, repo, backenddb)
     elif action == 'cleanup':
-        build = BuildService(obs_api, obs_user, obs_passwd)
         build.cleanup(project, "Cleaned up by %s" % name)
     else:
         raise LocalError("Not supported method of pre_release_obs job: %s" \