enable/disable image generation with 'Active' key (BMC#18692)
authorLi Yi <yix.li@intel.com>
Thu, 9 Jun 2011 11:27:11 +0000 (19:27 +0800)
committerLi Yi <yix.li@intel.com>
Wed, 22 Jun 2011 02:57:46 +0000 (10:57 +0800)
tools/kickstarter

index 9deb24f..dd71b70 100755 (executable)
@@ -173,7 +173,8 @@ def create_xml(image_meta):
                 fp = file('%s/%s' %(path, f), 'r')
                 local = yaml.load(fp)
                 conf = ks.parse(local)
-                image_xml(root,conf)
+                if conf.has_key('Active') and conf['Active']:
+                    image_xml(root,conf)
 
     str = etree.tostring(root, pretty_print=True)
     return str
@@ -210,16 +211,22 @@ if __name__ == '__main__':
     if image_meta.has_key('Configurations'):
         for img in image_meta['Configurations']:
             conf = ks.parse(img)
-            print "Creating %s (%s.ks)" %(img['Name'], img['FileName'] )
-            ks.process_files(conf, r)
+            if conf.has_key('Active') and conf['Active']:
+                print "Creating %s (%s.ks)" %(img['Name'], img['FileName'] )
+                ks.process_files(conf, r)
+            else:
+                print "%s is inactive, not generate %s this time" %(img['Name'], img['FileName'] )
     for path in image_meta['ExternalConfigs']:
         for f in os.listdir(path):
             if f.endswith('.yaml'):
                 fp = file('%s/%s' %(path, f), 'r')
                 local = yaml.load(fp)
                 conf = ks.parse(local)
-                print "Creating %s (%s.ks)" %(conf['Name'], conf['FileName'] )
-                ks.process_files(conf, r)
+                if conf.has_key('Active') and conf['Active']:
+                    print "Creating %s (%s.ks)" %(conf['Name'], conf['FileName'] )
+                    ks.process_files(conf, r)
+                else:
+                    print "%s is inactive, not generate %s this time" %(conf['Name'], conf['FileName'] )
             else:
                 print "WARNING: File '%s' ignored." % (f)