From f57d00275779ce86b457ad7efc8ceb4fbb020c43 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 24 Jan 2011 12:04:09 -0500 Subject: make the module list that cloud-config selects specified via cmdline instead of hard-coding in cloud-init-cfg the module list that should be read, read it from the second command line argument. Basically, instead of reading 'cloud_config_modules', specify 'cloud_config' when cloud-init-cfg is run. change the upstart job to invoke cloud-init-cfg with: exec cloud-init-cfg all cloud_config rather than exec cloud-init-cfg all --- cloud-init-cfg.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cloud-init-cfg.py') diff --git a/cloud-init-cfg.py b/cloud-init-cfg.py index b1c63a17..98bf63ce 100755 --- a/cloud-init-cfg.py +++ b/cloud-init-cfg.py @@ -35,11 +35,14 @@ def main(): # read cloud config jobs from config (builtin -> system) # and run all in order + modlist = "cloud_config" if len(sys.argv) < 2: Usage(sys.stderr) sys.exit(1) if sys.argv[1] == "all": name = "all" + if len(sys.argv) > 2: + modlist = sys.argv[2] else: freq = None run_args = [] @@ -64,16 +67,17 @@ def main(): module_list = [ ] if name == "all": - modules_list = CC.read_cc_modules(cc.cfg,"cloud_config_modules") + modlist_cfg_name = "%s_modules" % modlist + modules_list = CC.read_cc_modules(cc.cfg,modlist_cfg_name) if not len(modules_list): - err("no modules to run in cloud_config",log) + err("no modules to run in cloud_config [%s]" % modlist,log) sys.exit(0) else: module_list.append( [ name, freq ] + run_args ) failures = CC.run_cc_modules(cc,module_list,log) if len(failures): - err("errors running cloud_config modules: %s" % failures) + err("errors running cloud_config [%s]: %s" % (modlist,failures), log) sys.exit(len(failures)) def err(msg,log=None): -- cgit v1.2.3