summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
authorNate House nathan.house@rackspace.com <>2014-02-04 16:09:09 -0600
committerNate House nathan.house@rackspace.com <>2014-02-04 16:09:09 -0600
commit6e0aaf44c7a869d35a962a2d60be2d833023d4ec (patch)
tree2cf2bf8727e389c53e25190becb2ba44ac2ffd9d /cloudinit/config
parent6922fc8294e38ee0780e9d74da7d3ec010a3cd3c (diff)
parent0efeb26736ddae2967c14a9440088594da32070d (diff)
downloadvyos-cloud-init-6e0aaf44c7a869d35a962a2d60be2d833023d4ec.tar.gz
vyos-cloud-init-6e0aaf44c7a869d35a962a2d60be2d833023d4ec.zip
Merge gentoo branch and updated set-password to support systemctl
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_apt_configure.py2
-rw-r--r--cloudinit/config/cc_apt_pipelining.py3
-rw-r--r--cloudinit/config/cc_byobu.py1
-rw-r--r--cloudinit/config/cc_ca_certs.py1
-rw-r--r--cloudinit/config/cc_disk_setup.py1
-rw-r--r--cloudinit/config/cc_emit_upstart.py2
-rw-r--r--cloudinit/config/cc_growpart.py1
-rw-r--r--cloudinit/config/cc_grub_dpkg.py3
-rw-r--r--cloudinit/config/cc_keys_to_console.py2
-rw-r--r--cloudinit/config/cc_locale.py1
-rw-r--r--cloudinit/config/cc_migrator.py1
-rw-r--r--cloudinit/config/cc_mounts.py1
-rw-r--r--cloudinit/config/cc_package_update_upgrade_install.py1
-rw-r--r--cloudinit/config/cc_phone_home.py1
-rw-r--r--cloudinit/config/cc_puppet.py1
-rw-r--r--cloudinit/config/cc_resizefs.py1
-rw-r--r--cloudinit/config/cc_resolv_conf.py1
-rw-r--r--cloudinit/config/cc_rightscale_userdata.py1
-rw-r--r--cloudinit/config/cc_rsyslog.py1
-rw-r--r--cloudinit/config/cc_salt_minion.py1
-rw-r--r--cloudinit/config/cc_seed_random.py1
-rw-r--r--cloudinit/config/cc_set_hostname.py1
-rw-r--r--cloudinit/config/cc_set_passwords.py6
-rw-r--r--cloudinit/config/cc_ssh_authkey_fingerprints.py1
-rw-r--r--cloudinit/config/cc_timezone.py1
-rw-r--r--cloudinit/config/cc_update_etc_hosts.py1
-rw-r--r--cloudinit/config/cc_update_hostname.py1
-rw-r--r--cloudinit/config/cc_users_groups.py1
-rw-r--r--cloudinit/config/cc_yum_add_repo.py2
29 files changed, 40 insertions, 2 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py
index 29c13a3d..ccb45bb9 100644
--- a/cloudinit/config/cc_apt_configure.py
+++ b/cloudinit/config/cc_apt_configure.py
@@ -51,6 +51,8 @@ EXPORT_GPG_KEYID = """
def handle(name, cfg, cloud, log, _args):
+ if cloud.distro.is_excluded(name):
+ return
release = get_release()
mirrors = find_apt_mirror_info(cloud, cfg)
if not mirrors or "primary" not in mirrors:
diff --git a/cloudinit/config/cc_apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py
index e5629175..bd180e82 100644
--- a/cloudinit/config/cc_apt_pipelining.py
+++ b/cloudinit/config/cc_apt_pipelining.py
@@ -35,7 +35,8 @@ APT_PIPE_TPL = ("//Written by cloud-init per 'apt_pipelining'\n"
def handle(_name, cfg, _cloud, log, _args):
-
+ if _cloud.distro.is_excluded(_name):
+ return
apt_pipe_value = util.get_cfg_option_str(cfg, "apt_pipelining", False)
apt_pipe_value_s = str(apt_pipe_value).lower().strip()
diff --git a/cloudinit/config/cc_byobu.py b/cloudinit/config/cc_byobu.py
index 92d428b7..4821693b 100644
--- a/cloudinit/config/cc_byobu.py
+++ b/cloudinit/config/cc_byobu.py
@@ -29,6 +29,7 @@ distros = ['ubuntu', 'debian']
def handle(name, cfg, cloud, log, args):
+
if len(args) != 0:
value = args[0]
else:
diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py
index 4f2a46a1..7b339274 100644
--- a/cloudinit/config/cc_ca_certs.py
+++ b/cloudinit/config/cc_ca_certs.py
@@ -79,6 +79,7 @@ def handle(name, cfg, _cloud, log, _args):
@param args: Any module arguments from cloud.cfg
"""
# If there isn't a ca-certs section in the configuration don't do anything
+
if "ca-certs" not in cfg:
log.debug(("Skipping module named %s,"
" no 'ca-certs' key in configuration"), name)
diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py
index 0b970e4e..d0274ba6 100644
--- a/cloudinit/config/cc_disk_setup.py
+++ b/cloudinit/config/cc_disk_setup.py
@@ -40,6 +40,7 @@ def handle(_name, cfg, cloud, log, _args):
See doc/examples/cloud-config_disk-setup.txt for documentation on the
format.
"""
+
disk_setup = cfg.get("disk_setup")
if isinstance(disk_setup, dict):
update_disk_setup_devices(disk_setup, cloud.device_name_to_device)
diff --git a/cloudinit/config/cc_emit_upstart.py b/cloudinit/config/cc_emit_upstart.py
index 6d376184..5c2f6a31 100644
--- a/cloudinit/config/cc_emit_upstart.py
+++ b/cloudinit/config/cc_emit_upstart.py
@@ -29,6 +29,8 @@ distros = ['ubuntu', 'debian']
def handle(name, _cfg, cloud, log, args):
+ if cloud.distro.is_excluded(name):
+ return
event_names = args
if not event_names:
# Default to the 'cloud-config'
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index f52c41f0..4c5997fa 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -255,6 +255,7 @@ def resize_devices(resizer, devices):
def handle(_name, cfg, _cloud, log, _args):
+
if 'growpart' not in cfg:
log.debug("No 'growpart' entry in cfg. Using default: %s" %
DEFAULT_CONFIG)
diff --git a/cloudinit/config/cc_grub_dpkg.py b/cloudinit/config/cc_grub_dpkg.py
index b3ce6fb6..3fd92426 100644
--- a/cloudinit/config/cc_grub_dpkg.py
+++ b/cloudinit/config/cc_grub_dpkg.py
@@ -26,9 +26,12 @@ distros = ['ubuntu', 'debian']
def handle(_name, cfg, _cloud, log, _args):
+
idevs = None
idevs_empty = None
+ if _cloud.distro.is_excluded(_name):
+ return
if "grub-dpkg" in cfg:
idevs = util.get_cfg_option_str(cfg["grub-dpkg"],
"grub-pc/install_devices", None)
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index ed7af690..c9563e25 100644
--- a/cloudinit/config/cc_keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
@@ -30,6 +30,8 @@ HELPER_TOOL = '/usr/lib/cloud-init/write-ssh-key-fingerprints'
def handle(name, cfg, _cloud, log, _args):
+ if _cloud.distro.is_excluded(name):
+ return
if not os.path.exists(HELPER_TOOL):
log.warn(("Unable to activate module %s,"
" helper tool not found at %s"), name, HELPER_TOOL)
diff --git a/cloudinit/config/cc_locale.py b/cloudinit/config/cc_locale.py
index 6feaae9d..68399993 100644
--- a/cloudinit/config/cc_locale.py
+++ b/cloudinit/config/cc_locale.py
@@ -22,6 +22,7 @@ from cloudinit import util
def handle(name, cfg, cloud, log, args):
+
if len(args) != 0:
locale = args[0]
else:
diff --git a/cloudinit/config/cc_migrator.py b/cloudinit/config/cc_migrator.py
index facaa538..f7b2211a 100644
--- a/cloudinit/config/cc_migrator.py
+++ b/cloudinit/config/cc_migrator.py
@@ -75,6 +75,7 @@ def _migrate_legacy_sems(cloud, log):
def handle(name, cfg, cloud, log, _args):
+
do_migrate = util.get_cfg_option_str(cfg, "migrate", True)
if not util.translate_bool(do_migrate):
log.debug("Skipping module named %s, migration disabled", name)
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 80590118..c1ac76d4 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -76,6 +76,7 @@ def sanitize_devname(startname, transformer, log):
def handle(_name, cfg, cloud, log, _args):
+
# fs_spec, fs_file, fs_vfstype, fs_mntops, fs-freq, fs_passno
defvals = [None, None, "auto", "defaults,nobootwait", "0", "2"]
defvals = cfg.get("mount_default_fields", defvals)
diff --git a/cloudinit/config/cc_package_update_upgrade_install.py b/cloudinit/config/cc_package_update_upgrade_install.py
index 73b0e30d..85bc0240 100644
--- a/cloudinit/config/cc_package_update_upgrade_install.py
+++ b/cloudinit/config/cc_package_update_upgrade_install.py
@@ -49,6 +49,7 @@ def _fire_reboot(log, wait_attempts=6, initial_sleep=1, backoff=2):
def handle(_name, cfg, cloud, log, _args):
+
# Handle the old style + new config names
update = _multi_cfg_bool_get(cfg, 'apt_update', 'package_update')
upgrade = _multi_cfg_bool_get(cfg, 'package_upgrade', 'apt_upgrade')
diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py
index 2e058ccd..360fd83e 100644
--- a/cloudinit/config/cc_phone_home.py
+++ b/cloudinit/config/cc_phone_home.py
@@ -44,6 +44,7 @@ POST_LIST_ALL = [
# post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id
#
def handle(name, cfg, cloud, log, args):
+
if len(args) != 0:
ph_cfg = util.read_conf(args[0])
else:
diff --git a/cloudinit/config/cc_puppet.py b/cloudinit/config/cc_puppet.py
index 471a1a8a..717734d1 100644
--- a/cloudinit/config/cc_puppet.py
+++ b/cloudinit/config/cc_puppet.py
@@ -49,6 +49,7 @@ def _autostart_puppet(log):
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 module named %s,"
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index be406034..9d767873 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -76,6 +76,7 @@ def rootdev_from_cmdline(cmdline):
def handle(name, cfg, _cloud, log, args):
+
if len(args) != 0:
resize_root = args[0]
else:
diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py
index 879b62b1..feacebcd 100644
--- a/cloudinit/config/cc_resolv_conf.py
+++ b/cloudinit/config/cc_resolv_conf.py
@@ -92,6 +92,7 @@ def handle(name, cfg, _cloud, log, _args):
@param log: Pre-initialized Python logger object to use for logging.
@param args: Any module arguments from cloud.cfg
"""
+
if "manage_resolv_conf" not in cfg:
log.debug(("Skipping module named %s,"
" no 'manage_resolv_conf' key in configuration"), name)
diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
index c771728d..f99524d1 100644
--- a/cloudinit/config/cc_rightscale_userdata.py
+++ b/cloudinit/config/cc_rightscale_userdata.py
@@ -50,6 +50,7 @@ MY_HOOKNAME = 'CLOUD_INIT_REMOTE_HOOK'
def handle(name, _cfg, cloud, log, _args):
+
try:
ud = cloud.get_userdata_raw()
except:
diff --git a/cloudinit/config/cc_rsyslog.py b/cloudinit/config/cc_rsyslog.py
index 0c2c6880..7f70167e 100644
--- a/cloudinit/config/cc_rsyslog.py
+++ b/cloudinit/config/cc_rsyslog.py
@@ -35,6 +35,7 @@ def handle(name, cfg, cloud, log, _args):
# *.* @@syslogd.example.com
# process 'rsyslog'
+
if not 'rsyslog' in cfg:
log.debug(("Skipping module named %s,"
" no 'rsyslog' key in configuration"), name)
diff --git a/cloudinit/config/cc_salt_minion.py b/cloudinit/config/cc_salt_minion.py
index 53013dcb..b48762c8 100644
--- a/cloudinit/config/cc_salt_minion.py
+++ b/cloudinit/config/cc_salt_minion.py
@@ -22,6 +22,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 module named %s,"
diff --git a/cloudinit/config/cc_seed_random.py b/cloudinit/config/cc_seed_random.py
index 22a31f29..1676dd0a 100644
--- a/cloudinit/config/cc_seed_random.py
+++ b/cloudinit/config/cc_seed_random.py
@@ -39,6 +39,7 @@ def _decode(data, encoding=None):
def handle(name, cfg, cloud, log, _args):
+
if not cfg or "random_seed" not in cfg:
log.debug(("Skipping module named %s, "
"no 'random_seed' configuration found"), name)
diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py
index 5d7f4331..38246b57 100644
--- a/cloudinit/config/cc_set_hostname.py
+++ b/cloudinit/config/cc_set_hostname.py
@@ -22,6 +22,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 module %s"), name)
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index 56a36906..967769de 100644
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -36,6 +36,7 @@ PW_SET = (letters.translate(None, 'loLOI') +
def handle(_name, cfg, cloud, log, args):
+
if len(args) != 0:
# if run from command line, and give args, wipe the chpasswd['list']
password = args[0]
@@ -136,9 +137,12 @@ def handle(_name, cfg, cloud, log, args):
util.write_file(ssh_util.DEF_SSHD_CFG, "\n".join(lines))
try:
- cmd = ['service']
+ cmd = cloud.distro.init_cmd # Default service
cmd.append(cloud.distro.get_option('ssh_svcname', 'ssh'))
cmd.append('restart')
+ if 'systemctl' in cmd: # Switch action ordering
+ cmd[1], cmd[2] = cmd[2], cmd[1]
+ cmd = filter(None, cmd) # Remove empty arguments
util.subp(cmd)
log.debug("Restarted the ssh daemon")
except:
diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py
index be8083db..8b2708b1 100644
--- a/cloudinit/config/cc_ssh_authkey_fingerprints.py
+++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py
@@ -92,6 +92,7 @@ def _pprint_key_entries(user, key_fn, key_entries, hash_meth='md5',
def handle(name, cfg, cloud, log, _args):
+
if 'no_ssh_fingerprints' in cfg:
log.debug(("Skipping module named %s, "
"logging of ssh fingerprints disabled"), name)
diff --git a/cloudinit/config/cc_timezone.py b/cloudinit/config/cc_timezone.py
index b9eb85b2..bddcd0e9 100644
--- a/cloudinit/config/cc_timezone.py
+++ b/cloudinit/config/cc_timezone.py
@@ -26,6 +26,7 @@ frequency = PER_INSTANCE
def handle(name, cfg, cloud, log, args):
+
if len(args) != 0:
timezone = args[0]
else:
diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py
index d3dd1f32..3e3b4228 100644
--- a/cloudinit/config/cc_update_etc_hosts.py
+++ b/cloudinit/config/cc_update_etc_hosts.py
@@ -27,6 +27,7 @@ frequency = PER_ALWAYS
def handle(name, cfg, cloud, log, _args):
+
manage_hosts = util.get_cfg_option_str(cfg, "manage_etc_hosts", False)
if util.translate_bool(manage_hosts, addons=['template']):
(hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
diff --git a/cloudinit/config/cc_update_hostname.py b/cloudinit/config/cc_update_hostname.py
index e396ba13..56f6ebb7 100644
--- a/cloudinit/config/cc_update_hostname.py
+++ b/cloudinit/config/cc_update_hostname.py
@@ -27,6 +27,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 module %s"), name)
diff --git a/cloudinit/config/cc_users_groups.py b/cloudinit/config/cc_users_groups.py
index bf5b4581..30bf455d 100644
--- a/cloudinit/config/cc_users_groups.py
+++ b/cloudinit/config/cc_users_groups.py
@@ -27,6 +27,7 @@ frequency = PER_INSTANCE
def handle(name, cfg, cloud, _log, _args):
+
(users, groups) = ds.normalize_users_groups(cfg, cloud.distro)
for (name, members) in groups.items():
cloud.distro.create_group(name, members)
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index 5c273825..f63e3e08 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -58,6 +58,8 @@ def _format_repository_config(repo_id, repo_config):
def handle(name, cfg, _cloud, log, _args):
+ if _cloud.distro.is_excluded(name):
+ return
repos = cfg.get('yum_repos')
if not repos:
log.debug(("Skipping module named %s,"