Reset 'images' meta info for prerelease projects
authorEd Bartosh <eduard.bartosh@intel.com>
Sun, 4 May 2014 19:44:09 +0000 (22:44 +0300)
committerEd Bartosh <eduard.bartosh@intel.com>
Sun, 4 May 2014 19:47:55 +0000 (22:47 +0300)
Reset 'images' meta information when tag is updated (job_submit) or
package build is publised (job_prerelease_obs).

Fixes: #1854

Change-Id: Idf15c2110ac165cbc6f2917280c1da4ccd39c571
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
common/buildservice.py
job_pre_release_obs.py
job_submit.py

index 97fa82d..d7837e6 100644 (file)
@@ -444,12 +444,16 @@ class BuildService(OSC):
         if 'projects' in info:
             saved_info['projects'] = list(set(projects + info['projects']))
         if 'images' in info:
-            # remove the old one if already exist
-            for image in images:
-                if info['images'][0]['name'] == image['name']:
-                    images.remove(image)
+            if info['images']:
+                # remove the old one if already exist
+                for image in images:
+                    if info['images'][0]['name'] == image['name']:
+                        images.remove(image)
 
-            saved_info['images'] = images + info['images']
+                saved_info['images'] = images + info['images']
+            else:
+                # reset 'images'
+                saved_info['images'] = info['images']
         self.set_description(json.dumps(saved_info), prj, pkg)
 
     def get_info(self, prj, pkg=None):
index 02bb012..7e3bb21 100755 (executable)
@@ -265,6 +265,8 @@ def main(action):
                 return 0
 
         make_repo(project, repo, backenddb, base_url, base_path, live_repo_base)
+        # reset 'images' meta info
+        build.update_info({'images': []}, project)
     elif action == 'cleanup':
         # request(SR) end of life, this founction should be called to
         # delete the prerelease project "
index 91850c0..0022960 100755 (executable)
@@ -59,7 +59,8 @@ def create_project(git_url, git_project, git_tag, git_revision, build,
     info = {'projects': [git_project],
             'obs_target_prj': obs_target_prj,
             'git_tag': git_tag,
-            'git_commit': git_revision}
+            'git_commit': git_revision,
+            'images': []}
     if submitter:
         info['submitter'] = submitter.replace('<', '&lt;').replace('>', '&gt;')