diff options
Diffstat (limited to 'cloudinit/config/cc_power_state_change.py')
-rw-r--r-- | cloudinit/config/cc_power_state_change.py | 6 |
1 files changed, 6 insertions, 0 deletions
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).") |