summaryrefslogtreecommitdiff
path: root/cloud-init.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-08-02 17:09:43 -0400
committerScott Moser <smoser@ubuntu.com>2011-08-02 17:09:43 -0400
commit9d4a9dc17696d0465ae4f8b56db9c0948fcac28c (patch)
tree77b6c6c2d98016524f4191786dd6e89f2e28090b /cloud-init.py
parentfb0150dd71bf54bd46e30efab62dbb2f6eca2ba2 (diff)
downloadvyos-cloud-init-9d4a9dc17696d0465ae4f8b56db9c0948fcac28c.tar.gz
vyos-cloud-init-9d4a9dc17696d0465ae4f8b56db9c0948fcac28c.zip
This fixes LP: #819507, to make consume_userdata run 'always'
consume_userdata should really run always, rather than once per instance. The documentation says that boothooks were on their own for per-instance but since this routine was only being called once, they would only get called once. This modifies the behavior to be: user_script: per_always cloud_config : per_always upstart_job : per_instance cloud_boothook: per_always In order to not break part handlers that are existing, and expect to only be called once per instance, this adds a 'handler_version' item in a handler that can indicate the version (currently 1 or 2). If it is 2, then the hander will be passed the frequency (per-instance or per-always) that this is being run. That way the handler can differenciate between them. This also makes 'bootcmd' run every boot. That should be changable in cloud-config though, so users who dont like the behavior can modify it. LP: #819507
Diffstat (limited to 'cloud-init.py')
-rwxr-xr-xcloud-init.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cloud-init.py b/cloud-init.py
index 09c537f1..0ba00699 100755
--- a/cloud-init.py
+++ b/cloud-init.py
@@ -140,8 +140,10 @@ def main():
# parse the user data (ec2-run-userdata.py)
try:
- cloud.sem_and_run("consume_userdata", "once-per-instance",
- cloud.consume_userdata,[],False)
+ ran = cloud.sem_and_run("consume_userdata", cloudinit.per_instance,
+ cloud.consume_userdata,[cloudinit.per_instance],False)
+ if not ran:
+ cloud.consume_userdata(cloudinit.per_always)
except:
warn("consuming user data failed!\n")
raise