Change the way of dealing with has_images()
authorZhuoX Li <zhuox.li@intel.com>
Wed, 30 Apr 2014 09:33:54 +0000 (17:33 +0800)
committerYang Lin <lin.a.yang@intel.com>
Tue, 6 May 2014 03:53:53 +0000 (11:53 +0800)
After adding filter, some repos have no ks.
so need to make a distinction between not have image-configuration package,
and not have ks.

Change-Id: I5088c35a2c23f79557f277ccf0e04418c28ae471

job_pre_release_obs.py

index 7e3bb21..94f36d1 100755 (executable)
@@ -129,13 +129,20 @@ def make_repo(project, repo, backenddb, base_url, base_path, live_repo_base):
             # let's take it from target repo, only one package repo is enough
 
             # Add image configuration to prerelease repo
-            for rpm in find_files(os.path.join(snapshot.path, 'repos', repo['Name']),
+            img_conf = find_files(os.path.join(snapshot.path, 'repos', repo['Name']),
                                   prefix="image-configurations-",
-                                  suffix='noarch.rpm'):
+                                  suffix='noarch.rpm')
+            img_conf_list = list(img_conf)
+            # whether exist package of image-configuration
+            if not img_conf_list:
+                raise LocalError("Image configuration not found in %s" %
+                        snapshot.path)
+            for rpm in img_conf_list:
                 repomaker.load_imagedata(repo['Name'], rpm)
 
+        # whether exist ks poin to the repo
         if not repomaker.has_images():
-            raise LocalError("Image configuration not found in %s" % snapshot.path)
+            continue
 
         # Update ks files
         images_ks = update_ks(repomaker.imagedata, snapshot.build_id,