diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-10-17 16:46:39 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-10-17 16:46:39 -0400 |
commit | b27fab81c99fcb05f4c633bad62d4151edc702e6 (patch) | |
tree | 62ec24a13feea1922a3d570745f17a6136400219 | |
parent | 85d4fff9f7f7e8ffadca91258a25b5d2b3f43fd9 (diff) | |
parent | ad71260b802526d6751d4726a2efda62515fbf24 (diff) | |
download | vyos-cloud-init-b27fab81c99fcb05f4c633bad62d4151edc702e6.tar.gz vyos-cloud-init-b27fab81c99fcb05f4c633bad62d4151edc702e6.zip |
fix power_state_change config module so that example works, improve doc
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | cloudinit/config/cc_power_state_change.py | 6 | ||||
-rw-r--r-- | doc/examples/cloud-config-power-state.txt | 11 |
3 files changed, 18 insertions, 1 deletions
@@ -3,6 +3,8 @@ partitioned block device with target filesystem on ephemeral0.1. (LP: #1236594) - fix DataSourceAzure incompatibility with 2.6 (LP: #1232175) + - fix power_state_change config module so that example works. Improve + its documentation and add reference to 'timeout' 0.7.3: - fix omnibus chef installer (LP: #1182265) [Chris Wing] - small fix for OVF datasource for iso transport on non-iso9660 filesystem diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index 188047e5..e3150808 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -75,6 +75,12 @@ def load_power_state(cfg): ','.join(opt_map.keys())) delay = pstate.get("delay", "now") + # convert integer 30 or string '30' to '+30' + try: + delay = "+%s" % int(delay) + except ValueError: + pass + if delay != "now" and not re.match(r"\+[0-9]+", delay): raise TypeError("power_state[delay] must be 'now' or '+m' (minutes).") diff --git a/doc/examples/cloud-config-power-state.txt b/doc/examples/cloud-config-power-state.txt index 59f062d0..8df14366 100644 --- a/doc/examples/cloud-config-power-state.txt +++ b/doc/examples/cloud-config-power-state.txt @@ -12,11 +12,20 @@ # that may go to the console as a result of system services like # syslog being taken down while cloud-init is running. # +# If you delay '+5' (5 minutes) and have a timeout of +# 120 (2 minutes), then the max time until shutdown will be 7 minutes. +# cloud-init will invoke 'shutdown +5' after the process finishes, or +# when 'timeout' seconds have elapsed. +# # delay: form accepted by shutdown. default is 'now'. other format # accepted is +m (m in minutes) # mode: required. must be one of 'poweroff', 'halt', 'reboot' # message: provided as the message argument to 'shutdown'. default is none. +# timeout: the amount of time to give the cloud-init process to finish +# before executing shutdown. +# power_state: - delay: 30 + delay: "+30" mode: poweroff message: Bye Bye + timeout: 30 |