summaryrefslogtreecommitdiff
path: root/doc/examples/cloud-config-power-state.txt
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-09-08 16:53:59 -0400
committerScott Moser <smoser@ubuntu.com>2015-09-08 16:53:59 -0400
commitba3e59cbb5ae58a2267fcbcd23eecaaa26f2c396 (patch)
tree85bb47bb5166c1db7717c92905004d6d6e296fcd /doc/examples/cloud-config-power-state.txt
parent3c39c3f7638245e9581a2e1f4faae2dc2680f0c7 (diff)
downloadvyos-cloud-init-ba3e59cbb5ae58a2267fcbcd23eecaaa26f2c396.tar.gz
vyos-cloud-init-ba3e59cbb5ae58a2267fcbcd23eecaaa26f2c396.zip
power_state: support 'condition' argument
if 'condition' is provided to config in power_state, then consult it before powering off. This allows the user to shut down only if a condition is met, and leave the system in a debuggable state otherwise. An example is as simple as: power_state: mode: poweroff condition: ['sh', '-c', '[ -f /disable-poweroff ]']
Diffstat (limited to 'doc/examples/cloud-config-power-state.txt')
-rw-r--r--doc/examples/cloud-config-power-state.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/examples/cloud-config-power-state.txt b/doc/examples/cloud-config-power-state.txt
index 8df14366..b470153d 100644
--- a/doc/examples/cloud-config-power-state.txt
+++ b/doc/examples/cloud-config-power-state.txt
@@ -23,9 +23,18 @@
# 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.
+# condition: apply state change only if condition is met.
+# May be boolean True (always met), or False (never met),
+# or a command string or list to be executed.
+# command's exit code indicates:
+# 0: condition met
+# 1: condition not met
+# other exit codes will result in 'not met', but are reserved
+# for future use.
#
power_state:
delay: "+30"
mode: poweroff
message: Bye Bye
timeout: 30
+ condition: True