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 ++- doc/rtd/conf.py | 2 + doc/rtd/topics/modules.rst | 340 +++++++++++++++++++++++++++++- 4 files changed, 368 insertions(+), 18 deletions(-) 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 diff --git a/doc/rtd/conf.py b/doc/rtd/conf.py index 52a8f92b..9be02766 100644 --- a/doc/rtd/conf.py +++ b/doc/rtd/conf.py @@ -27,6 +27,8 @@ project = 'Cloud-Init' # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.intersphinx', + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', ] intersphinx_mapping = { diff --git a/doc/rtd/topics/modules.rst b/doc/rtd/topics/modules.rst index d4dd55df..d34c2969 100644 --- a/doc/rtd/topics/modules.rst +++ b/doc/rtd/topics/modules.rst @@ -1,3 +1,339 @@ -========= +======= Modules -========= +======= + +Apt Configure +------------- + +*Internal name:* ``cc_apt_configure`` + +.. automodule:: cloudinit.config.cc_apt_configure + +Apt Pipelining +-------------- + +*Internal name:* ``cc_apt_pipelining`` + +.. automodule:: cloudinit.config.cc_apt_pipelining + +Bootcmd +------- + +*Internal name:* ``cc_bootcmd`` + +.. automodule:: cloudinit.config.cc_bootcmd + +Byobu +----- + +*Internal name:* ``cc_byobu`` + +.. automodule:: cloudinit.config.cc_byobu + +Ca Certs +-------- + +*Internal name:* ``cc_ca_certs`` + +.. automodule:: cloudinit.config.cc_ca_certs + +Chef +---- + +*Internal name:* ``cc_chef`` + +.. automodule:: cloudinit.config.cc_chef + +Debug +----- + +*Internal name:* ``cc_debug`` + +.. automodule:: cloudinit.config.cc_debug + +Disable Ec2 Metadata +-------------------- + +*Internal name:* ``cc_disable_ec2_metadata`` + +.. automodule:: cloudinit.config.cc_disable_ec2_metadata + +Disk Setup +---------- + +*Internal name:* ``cc_disk_setup`` + +.. automodule:: cloudinit.config.cc_disk_setup + +Emit Upstart +------------ + +*Internal name:* ``cc_emit_upstart`` + +.. automodule:: cloudinit.config.cc_emit_upstart + +Final Message +------------- + +*Internal name:* ``cc_final_message`` + +.. automodule:: cloudinit.config.cc_final_message + +Foo +--- + +*Internal name:* ``cc_foo`` + +.. automodule:: cloudinit.config.cc_foo + +Growpart +-------- + +*Internal name:* ``cc_growpart`` + +.. automodule:: cloudinit.config.cc_growpart + +Grub Dpkg +--------- + +*Internal name:* ``cc_grub_dpkg`` + +.. automodule:: cloudinit.config.cc_grub_dpkg + +Keys To Console +--------------- + +*Internal name:* ``cc_keys_to_console`` + +.. automodule:: cloudinit.config.cc_keys_to_console + +Landscape +--------- + +*Internal name:* ``cc_landscape`` + +.. automodule:: cloudinit.config.cc_landscape + +Locale +------ + +*Internal name:* ``cc_locale`` + +.. automodule:: cloudinit.config.cc_locale + +Mcollective +----------- + +*Internal name:* ``cc_mcollective`` + +.. automodule:: cloudinit.config.cc_mcollective + +Migrator +-------- + +*Internal name:* ``cc_migrator`` + +.. automodule:: cloudinit.config.cc_migrator + +Mounts +------ + +*Internal name:* ``cc_mounts`` + +.. automodule:: cloudinit.config.cc_mounts + +Package Update Upgrade Install +------------------------------ + +*Internal name:* ``cc_package_update_upgrade_install`` + +.. automodule:: cloudinit.config.cc_package_update_upgrade_install + +Phone Home +---------- + +*Internal name:* ``cc_phone_home`` + +.. automodule:: cloudinit.config.cc_phone_home + +Power State Change +------------------ + +*Internal name:* ``cc_power_state_change`` + +.. automodule:: cloudinit.config.cc_power_state_change + +Puppet +------ + +*Internal name:* ``cc_puppet`` + +.. automodule:: cloudinit.config.cc_puppet + +Resizefs +-------- + +*Internal name:* ``cc_resizefs`` + +.. automodule:: cloudinit.config.cc_resizefs + +Resolv Conf +----------- + +*Internal name:* ``cc_resolv_conf`` + +.. automodule:: cloudinit.config.cc_resolv_conf + +Rightscale Userdata +------------------- + +*Internal name:* ``cc_rightscale_userdata`` + +.. automodule:: cloudinit.config.cc_rightscale_userdata + +Rsyslog +------- + +*Internal name:* ``cc_rsyslog`` + +.. automodule:: cloudinit.config.cc_rsyslog + +Runcmd +------ + +*Internal name:* ``cc_runcmd`` + +.. automodule:: cloudinit.config.cc_runcmd + +Salt Minion +----------- + +*Internal name:* ``cc_salt_minion`` + +.. automodule:: cloudinit.config.cc_salt_minion + +Scripts Per Boot +---------------- + +*Internal name:* ``cc_scripts_per_boot`` + +.. automodule:: cloudinit.config.cc_scripts_per_boot + +Scripts Per Instance +-------------------- + +*Internal name:* ``cc_scripts_per_instance`` + +.. automodule:: cloudinit.config.cc_scripts_per_instance + +Scripts Per Once +---------------- + +*Internal name:* ``cc_scripts_per_once`` + +.. automodule:: cloudinit.config.cc_scripts_per_once + +Scripts User +------------ + +*Internal name:* ``cc_scripts_user`` + +.. automodule:: cloudinit.config.cc_scripts_user + +Scripts Vendor +-------------- + +*Internal name:* ``cc_scripts_vendor`` + +.. automodule:: cloudinit.config.cc_scripts_vendor + +Seed Random +----------- + +*Internal name:* ``cc_seed_random`` + +.. automodule:: cloudinit.config.cc_seed_random + +Set Hostname +------------ + +*Internal name:* ``cc_set_hostname`` + +.. automodule:: cloudinit.config.cc_set_hostname + +Set Passwords +------------- + +*Internal name:* ``cc_set_passwords`` + +.. automodule:: cloudinit.config.cc_set_passwords + +Ssh +--- + +*Internal name:* ``cc_ssh`` + +.. automodule:: cloudinit.config.cc_ssh + +Ssh Authkey Fingerprints +------------------------ + +*Internal name:* ``cc_ssh_authkey_fingerprints`` + +.. automodule:: cloudinit.config.cc_ssh_authkey_fingerprints + +Ssh Import Id +------------- + +*Internal name:* ``cc_ssh_import_id`` + +.. automodule:: cloudinit.config.cc_ssh_import_id + +Timezone +-------- + +*Internal name:* ``cc_timezone`` + +.. automodule:: cloudinit.config.cc_timezone + +Ubuntu Init Switch +------------------ + +*Internal name:* ``cc_ubuntu_init_switch`` + +.. automodule:: cloudinit.config.cc_ubuntu_init_switch + +Update Etc Hosts +---------------- + +*Internal name:* ``cc_update_etc_hosts`` + +.. automodule:: cloudinit.config.cc_update_etc_hosts + +Update Hostname +--------------- + +*Internal name:* ``cc_update_hostname`` + +.. automodule:: cloudinit.config.cc_update_hostname + +Users Groups +------------ + +*Internal name:* ``cc_users_groups`` + +.. automodule:: cloudinit.config.cc_users_groups + +Write Files +----------- + +*Internal name:* ``cc_write_files`` + +.. automodule:: cloudinit.config.cc_write_files + +Yum Add Repo +------------ + +*Internal name:* ``cc_yum_add_repo`` + +.. automodule:: cloudinit.config.cc_yum_add_repo -- 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(+) 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(+) 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 10b4e49734526949da06426f9b102086aaaf7589 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 23 Oct 2014 17:59:02 -0700 Subject: Use bold for the internal name --- doc/rtd/topics/modules.rst | 96 +++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/doc/rtd/topics/modules.rst b/doc/rtd/topics/modules.rst index c9a2e60c..8cb786f4 100644 --- a/doc/rtd/topics/modules.rst +++ b/doc/rtd/topics/modules.rst @@ -5,49 +5,49 @@ Modules Apt Configure ------------- -*Internal name:* ``cc_apt_configure`` +**Internal name:** ``cc_apt_configure`` .. automodule:: cloudinit.config.cc_apt_configure Apt Pipelining -------------- -*Internal name:* ``cc_apt_pipelining`` +**Internal name:** ``cc_apt_pipelining`` .. automodule:: cloudinit.config.cc_apt_pipelining Bootcmd ------- -*Internal name:* ``cc_bootcmd`` +**Internal name:** ``cc_bootcmd`` .. automodule:: cloudinit.config.cc_bootcmd Byobu ----- -*Internal name:* ``cc_byobu`` +**Internal name:** ``cc_byobu`` .. automodule:: cloudinit.config.cc_byobu Ca Certs -------- -*Internal name:* ``cc_ca_certs`` +**Internal name:** ``cc_ca_certs`` .. automodule:: cloudinit.config.cc_ca_certs Chef ---- -*Internal name:* ``cc_chef`` +**Internal name:** ``cc_chef`` .. automodule:: cloudinit.config.cc_chef Debug ----- -*Internal name:* ``cc_debug`` +**Internal name:** ``cc_debug`` .. automodule:: cloudinit.config.cc_debug :members: @@ -55,286 +55,286 @@ Debug Disable Ec2 Metadata -------------------- -*Internal name:* ``cc_disable_ec2_metadata`` +**Internal name:** ``cc_disable_ec2_metadata`` .. automodule:: cloudinit.config.cc_disable_ec2_metadata Disk Setup ---------- -*Internal name:* ``cc_disk_setup`` +**Internal name:** ``cc_disk_setup`` .. automodule:: cloudinit.config.cc_disk_setup Emit Upstart ------------ -*Internal name:* ``cc_emit_upstart`` +**Internal name:** ``cc_emit_upstart`` .. automodule:: cloudinit.config.cc_emit_upstart Final Message ------------- -*Internal name:* ``cc_final_message`` +**Internal name:** ``cc_final_message`` .. automodule:: cloudinit.config.cc_final_message Foo --- -*Internal name:* ``cc_foo`` +**Internal name:** ``cc_foo`` .. automodule:: cloudinit.config.cc_foo Growpart -------- -*Internal name:* ``cc_growpart`` +**Internal name:** ``cc_growpart`` .. automodule:: cloudinit.config.cc_growpart Grub Dpkg --------- -*Internal name:* ``cc_grub_dpkg`` +**Internal name:** ``cc_grub_dpkg`` .. automodule:: cloudinit.config.cc_grub_dpkg Keys To Console --------------- -*Internal name:* ``cc_keys_to_console`` +**Internal name:** ``cc_keys_to_console`` .. automodule:: cloudinit.config.cc_keys_to_console Landscape --------- -*Internal name:* ``cc_landscape`` +**Internal name:** ``cc_landscape`` .. automodule:: cloudinit.config.cc_landscape Locale ------ -*Internal name:* ``cc_locale`` +**Internal name:** ``cc_locale`` .. automodule:: cloudinit.config.cc_locale Mcollective ----------- -*Internal name:* ``cc_mcollective`` +**Internal name:** ``cc_mcollective`` .. automodule:: cloudinit.config.cc_mcollective Migrator -------- -*Internal name:* ``cc_migrator`` +**Internal name:** ``cc_migrator`` .. automodule:: cloudinit.config.cc_migrator Mounts ------ -*Internal name:* ``cc_mounts`` +**Internal name:** ``cc_mounts`` .. automodule:: cloudinit.config.cc_mounts Package Update Upgrade Install ------------------------------ -*Internal name:* ``cc_package_update_upgrade_install`` +**Internal name:** ``cc_package_update_upgrade_install`` .. automodule:: cloudinit.config.cc_package_update_upgrade_install Phone Home ---------- -*Internal name:* ``cc_phone_home`` +**Internal name:** ``cc_phone_home`` .. automodule:: cloudinit.config.cc_phone_home Power State Change ------------------ -*Internal name:* ``cc_power_state_change`` +**Internal name:** ``cc_power_state_change`` .. automodule:: cloudinit.config.cc_power_state_change Puppet ------ -*Internal name:* ``cc_puppet`` +**Internal name:** ``cc_puppet`` .. automodule:: cloudinit.config.cc_puppet Resizefs -------- -*Internal name:* ``cc_resizefs`` +**Internal name:** ``cc_resizefs`` .. automodule:: cloudinit.config.cc_resizefs Resolv Conf ----------- -*Internal name:* ``cc_resolv_conf`` +**Internal name:** ``cc_resolv_conf`` .. automodule:: cloudinit.config.cc_resolv_conf Rightscale Userdata ------------------- -*Internal name:* ``cc_rightscale_userdata`` +**Internal name:** ``cc_rightscale_userdata`` .. automodule:: cloudinit.config.cc_rightscale_userdata Rsyslog ------- -*Internal name:* ``cc_rsyslog`` +**Internal name:** ``cc_rsyslog`` .. automodule:: cloudinit.config.cc_rsyslog Runcmd ------ -*Internal name:* ``cc_runcmd`` +**Internal name:** ``cc_runcmd`` .. automodule:: cloudinit.config.cc_runcmd Salt Minion ----------- -*Internal name:* ``cc_salt_minion`` +**Internal name:** ``cc_salt_minion`` .. automodule:: cloudinit.config.cc_salt_minion Scripts Per Boot ---------------- -*Internal name:* ``cc_scripts_per_boot`` +**Internal name:** ``cc_scripts_per_boot`` .. automodule:: cloudinit.config.cc_scripts_per_boot Scripts Per Instance -------------------- -*Internal name:* ``cc_scripts_per_instance`` +**Internal name:** ``cc_scripts_per_instance`` .. automodule:: cloudinit.config.cc_scripts_per_instance Scripts Per Once ---------------- -*Internal name:* ``cc_scripts_per_once`` +**Internal name:** ``cc_scripts_per_once`` .. automodule:: cloudinit.config.cc_scripts_per_once Scripts User ------------ -*Internal name:* ``cc_scripts_user`` +**Internal name:** ``cc_scripts_user`` .. automodule:: cloudinit.config.cc_scripts_user Scripts Vendor -------------- -*Internal name:* ``cc_scripts_vendor`` +**Internal name:** ``cc_scripts_vendor`` .. automodule:: cloudinit.config.cc_scripts_vendor Seed Random ----------- -*Internal name:* ``cc_seed_random`` +**Internal name:** ``cc_seed_random`` .. automodule:: cloudinit.config.cc_seed_random Set Hostname ------------ -*Internal name:* ``cc_set_hostname`` +**Internal name:** ``cc_set_hostname`` .. automodule:: cloudinit.config.cc_set_hostname Set Passwords ------------- -*Internal name:* ``cc_set_passwords`` +**Internal name:** ``cc_set_passwords`` .. automodule:: cloudinit.config.cc_set_passwords Ssh --- -*Internal name:* ``cc_ssh`` +**Internal name:** ``cc_ssh`` .. automodule:: cloudinit.config.cc_ssh Ssh Authkey Fingerprints ------------------------ -*Internal name:* ``cc_ssh_authkey_fingerprints`` +**Internal name:** ``cc_ssh_authkey_fingerprints`` .. automodule:: cloudinit.config.cc_ssh_authkey_fingerprints Ssh Import Id ------------- -*Internal name:* ``cc_ssh_import_id`` +**Internal name:** ``cc_ssh_import_id`` .. automodule:: cloudinit.config.cc_ssh_import_id Timezone -------- -*Internal name:* ``cc_timezone`` +**Internal name:** ``cc_timezone`` .. automodule:: cloudinit.config.cc_timezone Ubuntu Init Switch ------------------ -*Internal name:* ``cc_ubuntu_init_switch`` +**Internal name:** ``cc_ubuntu_init_switch`` .. automodule:: cloudinit.config.cc_ubuntu_init_switch Update Etc Hosts ---------------- -*Internal name:* ``cc_update_etc_hosts`` +**Internal name:** ``cc_update_etc_hosts`` .. automodule:: cloudinit.config.cc_update_etc_hosts Update Hostname --------------- -*Internal name:* ``cc_update_hostname`` +**Internal name:** ``cc_update_hostname`` .. automodule:: cloudinit.config.cc_update_hostname Users Groups ------------ -*Internal name:* ``cc_users_groups`` +**Internal name:** ``cc_users_groups`` .. automodule:: cloudinit.config.cc_users_groups Write Files ----------- -*Internal name:* ``cc_write_files`` +**Internal name:** ``cc_write_files`` .. automodule:: cloudinit.config.cc_write_files Yum Add Repo ------------ -*Internal name:* ``cc_yum_add_repo`` +**Internal name:** ``cc_yum_add_repo`` .. automodule:: cloudinit.config.cc_yum_add_repo -- 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(+) 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(-) 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