summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-01-24 12:04:09 -0500
committerScott Moser <smoser@ubuntu.com>2011-01-24 12:04:09 -0500
commitf57d00275779ce86b457ad7efc8ceb4fbb020c43 (patch)
treeeb163a293e17ae5af119e6243eef907b2b3325be
parentbe61755c7723790b68f30b8acaf1ce8ba2410dd4 (diff)
downloadvyos-cloud-init-f57d00275779ce86b457ad7efc8ceb4fbb020c43.tar.gz
vyos-cloud-init-f57d00275779ce86b457ad7efc8ceb4fbb020c43.zip
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
-rwxr-xr-xcloud-init-cfg.py10
-rw-r--r--upstart/cloud-config.conf2
2 files changed, 8 insertions, 4 deletions
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):
diff --git a/upstart/cloud-config.conf b/upstart/cloud-config.conf
index 6649a99d..5c6fed82 100644
--- a/upstart/cloud-config.conf
+++ b/upstart/cloud-config.conf
@@ -5,4 +5,4 @@ start on (filesystem and started rsyslog)
console output
task
-exec cloud-init-cfg all
+exec cloud-init-cfg all cloud_config