diff options
author | Wesley Wiedenmeier <wesley.wiedenmeier@gmail.com> | 2016-08-28 17:56:17 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-09-30 13:21:00 -0400 |
commit | 1071b9940b4e114cd2eabf290b739f92fbab33de (patch) | |
tree | a8fbef15c5be9510df93b4544e3bca1f74e2f29a /cloudinit/config/cc_power_state_change.py | |
parent | 02f6c4bb8cef17b3fe04ef4dc1ef199e20aeb4d9 (diff) | |
download | vyos-cloud-init-1071b9940b4e114cd2eabf290b739f92fbab33de.tar.gz vyos-cloud-init-1071b9940b4e114cd2eabf290b739f92fbab33de.zip |
Improve module documentation and doc cleanup.
This adds lots of config module documentation in a standard format.
It will greatly improve the content at readthedocs.
Additionally:
* Add a 'doc' env to tox.ini
* Changed default highlight language for sphinx conf from python to yaml
most examples in documentation are yaml configs
* Updated datasource examples to highlight sh code properly
Diffstat (limited to 'cloudinit/config/cc_power_state_change.py')
-rw-r--r-- | cloudinit/config/cc_power_state_change.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index cc3f7f70..61b5416a 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -16,6 +16,51 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +""" +Power State Change +------------------ +**Summary:** change power state + +This module handles shutdown/reboot after all config modules have been run. By +default it will take no action, and the system will keep running unless a +package installation/upgrade requires a system reboot (e.g. installing a new +kernel) and ``package_reboot_if_required`` is true. The ``power_state`` config +key accepts a dict of options. If ``mode`` is any value other than +``poweroff``, ``halt``, or ``reboot``, then no action will be taken. + +The system +can be shutdown before cloud-init has finished using the ``timeout`` option. +The ``delay`` key specifies a duration to be added onto any shutdown command +used. Therefore, if a 5 minute delay and a 120 second shutdown are specified, +the maximum amount of time between cloud-init starting and the system shutting +down is 7 minutes, and the minimum amount of time is 5 minutes. The ``delay`` +key must have an argument in a form that the ``shutdown`` utility recognizes. +The most common format is the form ``+5`` for 5 minutes. See ``man shutdown`` +for more options. + +Optionally, a command can be run to determine whether or not +the system should shut down. The command to be run should be specified in the +``condition`` key. For command formatting, see the documentation for +``cc_runcmd``. The specified shutdown behavior will only take place if the +``condition`` key is omitted or the command specified by the ``condition`` +key returns 0. + +**Internal name:** ``cc_power_state_change`` + +**Module frequency:** per instance + +**Supported distros:** all + +**Config keys**:: + + power_state: + delay: <now/'+minutes'> + mode: <poweroff/halt/reboot> + message: <shutdown message> + timeout: <seconds> + condition: <true/false/command> +""" + from cloudinit.settings import PER_INSTANCE from cloudinit import util |