From 68b6d0dc03a094e88f2d5357e9355b0f2e074937 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Thu, 9 Jun 2011 19:27:11 +0800 Subject: [PATCH] enable/disable image generation with 'Active' key (BMC#18692) --- tools/kickstarter | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/kickstarter b/tools/kickstarter index 9deb24f..dd71b70 100755 --- a/tools/kickstarter +++ b/tools/kickstarter @@ -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) -- 2.7.4