diff options
author | harlowja <harlowja@virtualbox.rhel> | 2012-06-21 09:12:16 -0700 |
---|---|---|
committer | harlowja <harlowja@virtualbox.rhel> | 2012-06-21 09:12:16 -0700 |
commit | 0c83ff5cb81b6de3028cf90e7dd6aba565682dbf (patch) | |
tree | a499408fa70a248b32f0e82e36b9ae893dce46e9 /cloudinit/config | |
parent | 64f1347cb8f2580339d539b7772e7872ed81cae9 (diff) | |
download | vyos-cloud-init-0c83ff5cb81b6de3028cf90e7dd6aba565682dbf.tar.gz vyos-cloud-init-0c83ff5cb81b6de3028cf90e7dd6aba565682dbf.zip |
1. Renames for debug message from 'transform' to 'module'
2. Fixing up more cloud.path.joins found to use the right ro/rw filename
Diffstat (limited to 'cloudinit/config')
29 files changed, 56 insertions, 44 deletions
diff --git a/cloudinit/config/cc_apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py index f460becb..3426099e 100644 --- a/cloudinit/config/cc_apt_pipelining.py +++ b/cloudinit/config/cc_apt_pipelining.py @@ -25,6 +25,9 @@ distros = ['ubuntu', 'debian'] DEFAULT_FILE = "/etc/apt/apt.conf.d/90cloud-init-pipelining" +APT_PIPE_TPL = ("//Written by cloud-init per 'apt_pipelining'\n" + 'Acquire::http::Pipeline-Depth "%s";\n') + # Acquire::http::Pipeline-Depth can be a value # from 0 to 5 indicating how many outstanding requests APT should send. # A value of zero MUST be specified if the remote host does not properly linger @@ -49,8 +52,7 @@ def handle(_name, cfg, cloud, log, _args): def write_apt_snippet(cloud, setting, log, f_name): """ Writes f_name with apt pipeline depth 'setting' """ - file_contents = ("//Written by cloud-init per 'apt_pipelining'\n" - 'Acquire::http::Pipeline-Depth "%s";\n') % (setting) + file_contents = APT_PIPE_TPL % (setting) util.write_file(cloud.paths.join(False, f_name), file_contents) diff --git a/cloudinit/config/cc_bootcmd.py b/cloudinit/config/cc_bootcmd.py index 635e3a1f..89ccf3f1 100644 --- a/cloudinit/config/cc_bootcmd.py +++ b/cloudinit/config/cc_bootcmd.py @@ -30,7 +30,7 @@ frequency = PER_ALWAYS def handle(name, cfg, cloud, log, _args): if "bootcmd" not in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'bootcmd' key in configuration"), name) return @@ -52,5 +52,5 @@ def handle(name, cfg, cloud, log, _args): util.subp(cmd, env=env, capture=False) except: util.logexc(log, - ("Failed to run bootcmd transform %s"), name) + ("Failed to run bootcmd module %s"), name) raise diff --git a/cloudinit/config/cc_byobu.py b/cloudinit/config/cc_byobu.py index 741aa934..38586174 100644 --- a/cloudinit/config/cc_byobu.py +++ b/cloudinit/config/cc_byobu.py @@ -30,7 +30,7 @@ def handle(name, cfg, _cloud, log, args): value = util.get_cfg_option_str(cfg, "byobu_by_default", "") if not value: - log.debug("Skipping transform named %s, no 'byobu' values found", name) + log.debug("Skipping module named %s, no 'byobu' values found", name) return if value == "user" or value == "system": diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py index 56c41561..3221a587 100644 --- a/cloudinit/config/cc_ca_certs.py +++ b/cloudinit/config/cc_ca_certs.py @@ -75,7 +75,7 @@ def handle(name, cfg, cloud, log, _args): """ # If there isn't a ca-certs section in the configuration don't do anything if "ca-certs" not in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'ca-certs' key in configuration"), name) return diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py index 74af2a7e..d8bd85f8 100644 --- a/cloudinit/config/cc_chef.py +++ b/cloudinit/config/cc_chef.py @@ -31,7 +31,7 @@ def handle(name, cfg, cloud, log, _args): # If there isn't a chef key in the configuration don't do anything if 'chef' not in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'chef' key in configuration"), name) return chef_cfg = cfg['chef'] diff --git a/cloudinit/config/cc_disable_ec2_metadata.py b/cloudinit/config/cc_disable_ec2_metadata.py index 62cca7cc..a7c6a75b 100644 --- a/cloudinit/config/cc_disable_ec2_metadata.py +++ b/cloudinit/config/cc_disable_ec2_metadata.py @@ -32,5 +32,5 @@ def handle(name, cfg, _cloud, log, _args): if disabled: util.subp(REJECT_CMD) else: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " disabling the ec2 route not enabled"), name) diff --git a/cloudinit/config/cc_foo.py b/cloudinit/config/cc_foo.py index e81e7faa..95aab4dd 100644 --- a/cloudinit/config/cc_foo.py +++ b/cloudinit/config/cc_foo.py @@ -49,4 +49,4 @@ frequency = PER_INSTANCE def handle(name, _cfg, _cloud, log, _args): - log.debug("Hi from transform %s", name) + log.debug("Hi from module %s", name) diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py index a8fb3ba7..d4c877f7 100644 --- a/cloudinit/config/cc_keys_to_console.py +++ b/cloudinit/config/cc_keys_to_console.py @@ -31,7 +31,7 @@ HELPER_TOOL = '/usr/lib/cloud-init/write-ssh-key-fingerprints' def handle(name, cfg, cloud, log, _args): if not os.path.exists(HELPER_TOOL): - log.warn(("Unable to activate transform %s," + log.warn(("Unable to activate module %s," " helper tool not found at %s"), name, HELPER_TOOL) return diff --git a/cloudinit/config/cc_landscape.py b/cloudinit/config/cc_landscape.py index 599276a7..d45c9203 100644 --- a/cloudinit/config/cc_landscape.py +++ b/cloudinit/config/cc_landscape.py @@ -56,7 +56,7 @@ def handle(name, cfg, cloud, log, _args): """ if not ConfigObj: log.warn(("'ConfigObj' support not available," - " running transform %s disabled"), name) + " running module %s disabled"), name) return ls_cloudcfg = cfg.get("landscape", {}) @@ -66,9 +66,14 @@ def handle(name, cfg, cloud, log, _args): " but not a dictionary type," " is a %s instead"), util.obj_name(ls_cloudcfg)) - lsc_client_fn = cloud.paths.join(True, LSC_CLIENT_CFG_FILE) - merged = merge_together([LSC_BUILTIN_CFG, lsc_client_fn, ls_cloudcfg]) + merge_data = [ + LSC_BUILTIN_CFG, + cloud.paths.join(True, LSC_CLIENT_CFG_FILE), + ls_cloudcfg, + ] + merged = merge_together(merge_data) + lsc_client_fn = cloud.paths.join(False, LSC_CLIENT_CFG_FILE) lsc_dir = cloud.paths.join(False, os.path.dirname(lsc_client_fn)) if not os.path.isdir(lsc_dir): util.ensure_dir(lsc_dir) diff --git a/cloudinit/config/cc_locale.py b/cloudinit/config/cc_locale.py index 7f273123..3fb4c5d9 100644 --- a/cloudinit/config/cc_locale.py +++ b/cloudinit/config/cc_locale.py @@ -49,7 +49,7 @@ def handle(name, cfg, cloud, log, args): "/etc/default/locale") if not locale: - log.debug(("Skipping transform named %s, " + log.debug(("Skipping module named %s, " "no 'locale' configuration found"), name) return diff --git a/cloudinit/config/cc_mcollective.py b/cloudinit/config/cc_mcollective.py index 3fec6729..36a4cade 100644 --- a/cloudinit/config/cc_mcollective.py +++ b/cloudinit/config/cc_mcollective.py @@ -32,7 +32,7 @@ def handle(name, cfg, cloud, log, _args): # If there isn't a mcollective key in the configuration don't do anything if 'mcollective' not in cfg: - log.debug(("Skipping transform named %s, " + log.debug(("Skipping module named %s, " "no 'mcollective' key in configuration"), name) return diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py index ab097c2a..d3dcf7af 100644 --- a/cloudinit/config/cc_mounts.py +++ b/cloudinit/config/cc_mounts.py @@ -188,8 +188,9 @@ def handle(_name, cfg, cloud, log, _args): util.logexc(log, "Activating swap via 'swapon -a' failed") for d in dirs: + real_dir = cloud.paths.join(False, d) try: - util.ensure_dir(cloud.paths.join(False, d)) + util.ensure_dir(real_dir) except: util.logexc(log, "Failed to make '%s' config-mount", d) diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py index dcb07b66..d929eb64 100644 --- a/cloudinit/config/cc_phone_home.py +++ b/cloudinit/config/cc_phone_home.py @@ -53,7 +53,7 @@ def handle(name, cfg, cloud, log, args): ph_cfg = cfg['phone_home'] if 'url' not in ph_cfg: - log.warn(("Skipping transform named %s, " + log.warn(("Skipping module named %s, " "no 'url' found in 'phone_home' configuration"), name) return diff --git a/cloudinit/config/cc_puppet.py b/cloudinit/config/cc_puppet.py index 5154efba..467c1496 100644 --- a/cloudinit/config/cc_puppet.py +++ b/cloudinit/config/cc_puppet.py @@ -31,7 +31,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, _args): # If there isn't a puppet key in the configuration don't do anything if 'puppet' not in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'puppet' configuration found"), name) return @@ -43,7 +43,7 @@ def handle(name, cfg, cloud, log, _args): # ... and then update the puppet configuration if 'conf' in puppet_cfg: # Add all sections from the conf object to puppet.conf - puppet_conf_fn = cloud.paths.join(False, '/etc/puppet/puppet.conf') + puppet_conf_fn = cloud.paths.join(True, '/etc/puppet/puppet.conf') contents = util.load_file(puppet_conf_fn) # Create object for reading puppet.conf values puppet_config = helpers.DefaultingConfigParser() @@ -89,9 +89,11 @@ def handle(name, cfg, cloud, log, _args): puppet_config.set(cfg_name, o, v) # We got all our config as wanted we'll rename # the previous puppet.conf and create our new one - puppet_conf_old_fn = "%s.old" % (puppet_conf_fn) - util.rename(puppet_conf_fn, puppet_conf_old_fn) - util.write_file(puppet_conf_fn, puppet_config.stringify()) + conf_old_fn = cloud.paths.join(False, + '/etc/puppet/puppet.conf.old') + util.rename(puppet_conf_fn, conf_old_fn) + puppet_conf_rw = cloud.paths.join(False, '/etc/puppet/puppet.conf') + util.write_file(puppet_conf_rw, puppet_config.stringify()) # Set puppet to automatically start if os.path.exists('/etc/default/puppet'): diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index c019989e..7e1428e9 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -69,7 +69,7 @@ def handle(name, cfg, cloud, log, args): resize_root = util.get_cfg_option_str(cfg, "resize_rootfs", True) if not util.translate_bool(resize_root): - log.debug("Skipping transform named %s, resizing disabled", name) + log.debug("Skipping module named %s, resizing disabled", name) return # TODO is the directory ok to be used?? diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py index 8385e281..7a134569 100644 --- a/cloudinit/config/cc_rightscale_userdata.py +++ b/cloudinit/config/cc_rightscale_userdata.py @@ -53,13 +53,13 @@ def handle(name, _cfg, cloud, log, _args): try: ud = cloud.get_userdata_raw() except: - log.warn("Failed to get raw userdata in transform %s", name) + log.warn("Failed to get raw userdata in module %s", name) return try: mdict = parse_qs(ud) if not mdict or not MY_HOOKNAME in mdict: - log.debug(("Skipping transform %s, " + log.debug(("Skipping module %s, " "did not find %s in parsed" " raw userdata"), name, MY_HOOKNAME) return @@ -73,7 +73,7 @@ def handle(name, _cfg, cloud, log, _args): # These will eventually be then ran by the cc_scripts_user # TODO: maybe this should just be a new user data handler?? - # Instead of a late transform that acts like a user data handler? + # Instead of a late module that acts like a user data handler? scripts_d = cloud.get_ipath_cur('scripts') urls = mdict[MY_HOOKNAME] for (i, url) in enumerate(urls): diff --git a/cloudinit/config/cc_rsyslog.py b/cloudinit/config/cc_rsyslog.py index f2c1de1e..78327526 100644 --- a/cloudinit/config/cc_rsyslog.py +++ b/cloudinit/config/cc_rsyslog.py @@ -36,7 +36,7 @@ def handle(name, cfg, cloud, log, _args): # process 'rsyslog' if not 'rsyslog' in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'rsyslog' key in configuration"), name) return diff --git a/cloudinit/config/cc_runcmd.py b/cloudinit/config/cc_runcmd.py index f121484b..65064cfb 100644 --- a/cloudinit/config/cc_runcmd.py +++ b/cloudinit/config/cc_runcmd.py @@ -25,7 +25,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, _args): if "runcmd" not in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'runcmd' key in configuration"), name) return diff --git a/cloudinit/config/cc_salt_minion.py b/cloudinit/config/cc_salt_minion.py index 986e6db6..ff90d07a 100644 --- a/cloudinit/config/cc_salt_minion.py +++ b/cloudinit/config/cc_salt_minion.py @@ -24,7 +24,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, _args): # If there isn't a salt key in the configuration don't do anything if 'salt_minion' not in cfg: - log.debug(("Skipping transform named %s," + log.debug(("Skipping module named %s," " no 'salt_minion' key in configuration"), name) return @@ -34,8 +34,8 @@ def handle(name, cfg, cloud, log, _args): cloud.distro.install_packages(["salt"]) # Ensure we can configure files at the right dir - config_dir = salt_cfg.get("config_dir", '/etc/salt') - config_dir = cloud.paths.join(False, config_dir) + config_dir = cloud.paths.join(False, salt_cfg.get("config_dir", + '/etc/salt')) util.ensure_dir(config_dir) # ... and then update the salt configuration @@ -47,8 +47,8 @@ def handle(name, cfg, cloud, log, _args): # ... copy the key pair if specified if 'public_key' in salt_cfg and 'private_key' in salt_cfg: - pki_dir = salt_cfg.get('pki_dir', '/etc/salt/pki') - pki_dir = cloud.paths.join(pki_dir) + pki_dir = cloud.paths.join(False, salt_cfg.get('pki_dir', + '/etc/salt/pki')) with util.umask(077): util.ensure_dir(pki_dir) pub_name = os.path.join(pki_dir, 'minion.pub') diff --git a/cloudinit/config/cc_scripts_per_boot.py b/cloudinit/config/cc_scripts_per_boot.py index d3c47442..42b987eb 100644 --- a/cloudinit/config/cc_scripts_per_boot.py +++ b/cloudinit/config/cc_scripts_per_boot.py @@ -36,6 +36,6 @@ def handle(name, _cfg, cloud, log, _args): try: util.runparts(runparts_path) except: - log.warn("Failed to run transform %s (%s in %s)", + log.warn("Failed to run module %s (%s in %s)", name, SCRIPT_SUBDIR, runparts_path) raise diff --git a/cloudinit/config/cc_scripts_per_instance.py b/cloudinit/config/cc_scripts_per_instance.py index 8e428ac2..b5d71c13 100644 --- a/cloudinit/config/cc_scripts_per_instance.py +++ b/cloudinit/config/cc_scripts_per_instance.py @@ -36,6 +36,6 @@ def handle(name, _cfg, cloud, log, _args): try: util.runparts(runparts_path) except: - log.warn("Failed to run transform %s (%s in %s)", + log.warn("Failed to run module %s (%s in %s)", name, SCRIPT_SUBDIR, runparts_path) raise diff --git a/cloudinit/config/cc_scripts_per_once.py b/cloudinit/config/cc_scripts_per_once.py index e7a29a44..d77d36d5 100644 --- a/cloudinit/config/cc_scripts_per_once.py +++ b/cloudinit/config/cc_scripts_per_once.py @@ -36,6 +36,6 @@ def handle(name, _cfg, cloud, log, _args): try: util.runparts(runparts_path) except: - log.warn("Failed to run transform %s (%s in %s)", + log.warn("Failed to run module %s (%s in %s)", name, SCRIPT_SUBDIR, runparts_path) raise diff --git a/cloudinit/config/cc_scripts_user.py b/cloudinit/config/cc_scripts_user.py index 1ff05aae..5c53014f 100644 --- a/cloudinit/config/cc_scripts_user.py +++ b/cloudinit/config/cc_scripts_user.py @@ -37,6 +37,6 @@ def handle(name, _cfg, cloud, log, _args): try: util.runparts(runparts_path) except: - log.warn("Failed to run transform %s (%s in %s)", + log.warn("Failed to run module %s (%s in %s)", name, SCRIPT_SUBDIR, runparts_path) raise diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py index 3ac8a8fa..b0f27ebf 100644 --- a/cloudinit/config/cc_set_hostname.py +++ b/cloudinit/config/cc_set_hostname.py @@ -24,7 +24,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, _args): if util.get_cfg_option_bool(cfg, "preserve_hostname", False): log.debug(("Configuration option 'preserve_hostname' is set," - " not setting the hostname in transform %s"), name) + " not setting the hostname in module %s"), name) return (hostname, _fqdn) = util.get_hostname_fqdn(cfg, cloud) diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index ce17f357..eb68ddfe 100644 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -106,7 +106,9 @@ def handle(_name, cfg, cloud, log, args): replacement = "PasswordAuthentication %s" % (pw_auth) # See http://linux.die.net/man/5/sshd_config - old_lines = util.load_file('/etc/ssh/sshd_config').splitlines() + conf_fn = cloud.paths.join(True, '/etc/ssh/sshd_config') + # Todo: use the common ssh_util function for this parsing... + old_lines = util.load_file(conf_fn).splitlines() for i, line in enumerate(old_lines): if not line.strip() or line.startswith("#"): new_lines.append(line) diff --git a/cloudinit/config/cc_ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py index d57e4665..c58b28ec 100644 --- a/cloudinit/config/cc_ssh_import_id.py +++ b/cloudinit/config/cc_ssh_import_id.py @@ -36,11 +36,11 @@ def handle(name, cfg, _cloud, log, args): ids = util.get_cfg_option_list(cfg, "ssh_import_id", []) if len(ids) == 0: - log.debug("Skipping transform named %s, no ids found to import", name) + log.debug("Skipping module named %s, no ids found to import", name) return if not user: - log.debug("Skipping transform named %s, no user found to import", name) + log.debug("Skipping module named %s, no user found to import", name) return cmd = ["sudo", "-Hu", user, "ssh-import-id"] + ids diff --git a/cloudinit/config/cc_timezone.py b/cloudinit/config/cc_timezone.py index 747c436c..b9eb85b2 100644 --- a/cloudinit/config/cc_timezone.py +++ b/cloudinit/config/cc_timezone.py @@ -32,7 +32,7 @@ def handle(name, cfg, cloud, log, args): timezone = util.get_cfg_option_str(cfg, "timezone", False) if not timezone: - log.debug("Skipping transform named %s, no 'timezone' specified", name) + log.debug("Skipping module named %s, no 'timezone' specified", name) return # Let the distro handle settings its timezone diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py index 75615db1..6820ac4f 100644 --- a/cloudinit/config/cc_update_etc_hosts.py +++ b/cloudinit/config/cc_update_etc_hosts.py @@ -57,4 +57,4 @@ def handle(name, cfg, cloud, log, _args): cloud.distro.update_etc_hosts(hostname, fqdn) else: log.debug(("Configuration option 'manage_etc_hosts' is not set," - " not managing /etc/hosts in transform %s"), name) + " not managing /etc/hosts in module %s"), name) diff --git a/cloudinit/config/cc_update_hostname.py b/cloudinit/config/cc_update_hostname.py index 58444fab..b84a1a06 100644 --- a/cloudinit/config/cc_update_hostname.py +++ b/cloudinit/config/cc_update_hostname.py @@ -29,7 +29,7 @@ frequency = PER_ALWAYS def handle(name, cfg, cloud, log, _args): if util.get_cfg_option_bool(cfg, "preserve_hostname", False): log.debug(("Configuration option 'preserve_hostname' is set," - " not updating the hostname in transform %s"), name) + " not updating the hostname in module %s"), name) return (hostname, _fqdn) = util.get_hostname_fqdn(cfg, cloud) |