summaryrefslogtreecommitdiff
path: root/cloud-init.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-06-17 11:03:49 -0400
committerScott Moser <smoser@ubuntu.com>2011-06-17 11:03:49 -0400
commit03804622f0fa6963ddfe9fa9292b28653665365a (patch)
tree6ee5335312c214806dd9f575680499b39d10fedf /cloud-init.py
parenta8cd78271c23e13f178aa0d1ee90f8ae5ff640f4 (diff)
downloadvyos-cloud-init-03804622f0fa6963ddfe9fa9292b28653665365a.tar.gz
vyos-cloud-init-03804622f0fa6963ddfe9fa9292b28653665365a.zip
make the "cloud-config ready" command configurable (LP: #785551)
Previously, when cloud-config was ready, cloud-init would emit an upstart event with: initctl emit cloud-config Now, that command is configurable via the 'cc_ready_cmd' value in cloud.cfg or user data. The default behavior is not changed. LP: #785551
Diffstat (limited to 'cloud-init.py')
-rwxr-xr-xcloud-init.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/cloud-init.py b/cloud-init.py
index ee08c191..09c537f1 100755
--- a/cloud-init.py
+++ b/cloud-init.py
@@ -146,9 +146,6 @@ def main():
warn("consuming user data failed!\n")
raise
- # finish, send the cloud-config event
- cloud.initctl_emit()
-
cfg_path = cloudinit.get_ipath_cur("cloud_config")
cc = CC.CloudConfig(cfg_path, cloud)
@@ -163,6 +160,16 @@ def main():
except Exception as e:
warn("Failed to get and set output config: %s\n" % e)
+ # send the cloud-config ready event
+ cc_path = cloudinit.get_ipath_cur('cloud_config')
+ cc_ready = cc.cfg.get("cc_ready_cmd",
+ ['initctl', 'emit', 'cloud-config',
+ '%s=%s' % (cloudinit.cfg_env_name, cc_path) ])
+ if cc_ready:
+ if isinstance(cc_ready,str):
+ cc_ready = [ 'sh', '-c', cc_ready]
+ subprocess.Popen(cc_ready).communicate()
+
module_list = CC.read_cc_modules(cc.cfg,"cloud_init_modules")
failures = []