From ba09a65a307651144a72a0a0e554895ac0440c45 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 23 Oct 2014 17:47:19 -0700 Subject: Add the beginnings of module documentation --- cloudinit/config/cc_debug.py | 15 +++++++++++++++ cloudinit/config/cc_ubuntu_init_switch.py | 29 +++++++++++++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_debug.py b/cloudinit/config/cc_debug.py index 7219b0f8..89627012 100644 --- a/cloudinit/config/cc_debug.py +++ b/cloudinit/config/cc_debug.py @@ -14,6 +14,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +""" +**Summary:** helper to debug cloud-init *internal* datastructures. + +**Description:** This module will enable for outputting various internal +information that cloud-init sources provide to either a file or to the output +console/log location that this cloud-init has been configured with when +running. + +It can be configured with the following option structure:: + + debug: + verbose: (defaulting to true) + output: (location to write output, defaulting to console + log) +""" + from cloudinit import type_utils from cloudinit import util import copy diff --git a/cloudinit/config/cc_ubuntu_init_switch.py b/cloudinit/config/cc_ubuntu_init_switch.py index 6f994bff..b23f70c7 100644 --- a/cloudinit/config/cc_ubuntu_init_switch.py +++ b/cloudinit/config/cc_ubuntu_init_switch.py @@ -17,30 +17,27 @@ # along with this program. If not, see . """ -ubuntu_init_switch: reboot system into another init +**Summary:** reboot system into another init. -This provides a way for the user to boot with systemd even if the -image is set to boot with upstart. It should be run as one of the first -cloud_init_modules, and will switch the init system and then issue a reboot. -The next boot will come up in the target init system and no action will +**Description:** This module provides a way for the user to boot with systemd +even if the image is set to boot with upstart. It should be run as one of the +first cloud_init_modules, and will switch the init system and then issue a +reboot. The next boot will come up in the target init system and no action will be taken. This should be inert on non-ubuntu systems, and also exit quickly. -config is comes under the top level 'init_switch' dictionary. +It can be configured with the following option structure:: -#cloud-config -init_switch: - target: systemd - reboot: true + init_switch: + target: systemd (can be 'systemd' or 'upstart') + reboot: true (reboot if a change was made, or false to not reboot) -'target' can be 'systemd' or 'upstart'. Best effort is made, but its possible -this system will break, and probably won't interact well with any other -mechanism you've used to switch the init system. +.. note:: -'reboot': [default=true]. - true: reboot if a change was made. - false: do not reboot. + Best effort is made, but it's possible + this system will break, and probably won't interact well with any other + mechanism you've used to switch the init system. """ from cloudinit.settings import PER_INSTANCE -- cgit v1.2.3 From 17f180790f4a8b7f818b76abf34cc6b2ba61f0af Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 23 Oct 2014 17:51:47 -0700 Subject: Not that log_cfgs are not shown. --- cloudinit/config/cc_debug.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_debug.py b/cloudinit/config/cc_debug.py index 89627012..39d85fdc 100644 --- a/cloudinit/config/cc_debug.py +++ b/cloudinit/config/cc_debug.py @@ -27,6 +27,10 @@ It can be configured with the following option structure:: debug: verbose: (defaulting to true) output: (location to write output, defaulting to console + log) + +.. note:: + + Log configurations are not output. """ from cloudinit import type_utils -- cgit v1.2.3 From 69f4a9c5d73be23d00be0fefb41788e6744112e7 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 23 Oct 2014 17:57:10 -0700 Subject: Add a link to the module code --- cloudinit/config/cc_debug.py | 2 ++ doc/rtd/topics/modules.rst | 1 + 2 files changed, 3 insertions(+) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_debug.py b/cloudinit/config/cc_debug.py index 39d85fdc..a3af4500 100644 --- a/cloudinit/config/cc_debug.py +++ b/cloudinit/config/cc_debug.py @@ -51,6 +51,8 @@ def _make_header(text): def handle(name, cfg, cloud, log, args): + """Handler method activated by cloud-init.""" + verbose = util.get_cfg_by_path(cfg, ('debug', 'verbose'), default=True) if args: # if args are provided (from cmdline) then explicitly set verbose diff --git a/doc/rtd/topics/modules.rst b/doc/rtd/topics/modules.rst index d34c2969..c9a2e60c 100644 --- a/doc/rtd/topics/modules.rst +++ b/doc/rtd/topics/modules.rst @@ -50,6 +50,7 @@ Debug *Internal name:* ``cc_debug`` .. automodule:: cloudinit.config.cc_debug + :members: Disable Ec2 Metadata -------------------- -- cgit v1.2.3 From fe9ff4691afe50a4c9192b96a872fec319e2606b Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 23 Oct 2014 18:01:06 -0700 Subject: Show the handle method for the cc_ubuntu_init_switch module --- cloudinit/config/cc_ubuntu_init_switch.py | 1 + doc/rtd/topics/modules.rst | 1 + 2 files changed, 2 insertions(+) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_ubuntu_init_switch.py b/cloudinit/config/cc_ubuntu_init_switch.py index b23f70c7..12b6d6d5 100644 --- a/cloudinit/config/cc_ubuntu_init_switch.py +++ b/cloudinit/config/cc_ubuntu_init_switch.py @@ -88,6 +88,7 @@ fi def handle(name, cfg, cloud, log, args): + """Handler method activated by cloud-init.""" if not isinstance(cloud.distro, ubuntu.Distro): log.debug("%s: distro is '%s', not ubuntu. returning", diff --git a/doc/rtd/topics/modules.rst b/doc/rtd/topics/modules.rst index 8cb786f4..b50acbfa 100644 --- a/doc/rtd/topics/modules.rst +++ b/doc/rtd/topics/modules.rst @@ -303,6 +303,7 @@ Ubuntu Init Switch **Internal name:** ``cc_ubuntu_init_switch`` .. automodule:: cloudinit.config.cc_ubuntu_init_switch + :members: Update Etc Hosts ---------------- -- cgit v1.2.3 From 24e6ef998899418d73a63a64141fbaa209320967 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 23 Oct 2014 18:02:37 -0700 Subject: Make the cloud_init_modules look like a heredoc/inline heredoc --- cloudinit/config/cc_ubuntu_init_switch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_ubuntu_init_switch.py b/cloudinit/config/cc_ubuntu_init_switch.py index 12b6d6d5..7e88ed85 100644 --- a/cloudinit/config/cc_ubuntu_init_switch.py +++ b/cloudinit/config/cc_ubuntu_init_switch.py @@ -21,7 +21,7 @@ **Description:** This module provides a way for the user to boot with systemd even if the image is set to boot with upstart. It should be run as one of the -first cloud_init_modules, and will switch the init system and then issue a +first ``cloud_init_modules``, and will switch the init system and then issue a reboot. The next boot will come up in the target init system and no action will be taken. -- cgit v1.2.3