diff options
author | Nate House nathan.house@rackspace.com <> | 2014-01-27 16:34:35 -0600 |
---|---|---|
committer | Nate House nathan.house@rackspace.com <> | 2014-01-27 16:34:35 -0600 |
commit | 79d1eccc9fa751325fcb574fd9385a14bf2bbba6 (patch) | |
tree | 779f3570e484fa1d218d40ded165c65f5f61790d /cloudinit/config | |
parent | 309457a96a84132d2e570bf902c464b2a1aa9d0b (diff) | |
download | vyos-cloud-init-79d1eccc9fa751325fcb574fd9385a14bf2bbba6.tar.gz vyos-cloud-init-79d1eccc9fa751325fcb574fd9385a14bf2bbba6.zip |
Removed excessive is_excluded module calls
Diffstat (limited to 'cloudinit/config')
22 files changed, 21 insertions, 38 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py index a1be7514..ccb45bb9 100644 --- a/cloudinit/config/cc_apt_configure.py +++ b/cloudinit/config/cc_apt_configure.py @@ -51,7 +51,7 @@ EXPORT_GPG_KEYID = """ def handle(name, cfg, cloud, log, _args): - if cloud.is_excluded(name): + if cloud.distro.is_excluded(name): return release = get_release() mirrors = find_apt_mirror_info(cloud, cfg) diff --git a/cloudinit/config/cc_apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py index 15e509ac..bd180e82 100644 --- a/cloudinit/config/cc_apt_pipelining.py +++ b/cloudinit/config/cc_apt_pipelining.py @@ -35,7 +35,7 @@ APT_PIPE_TPL = ("//Written by cloud-init per 'apt_pipelining'\n" def handle(_name, cfg, _cloud, log, _args): - if _cloud.is_excluded(_name): + 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 f708ca5f..4821693b 100644 --- a/cloudinit/config/cc_byobu.py +++ b/cloudinit/config/cc_byobu.py @@ -29,8 +29,7 @@ distros = ['ubuntu', 'debian'] def handle(name, cfg, cloud, log, args): - if cloud.is_excluded(name): - return + 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 97af3705..7b339274 100644 --- a/cloudinit/config/cc_ca_certs.py +++ b/cloudinit/config/cc_ca_certs.py @@ -79,8 +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 _cloud.is_excluded(name): - return + 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_chef.py b/cloudinit/config/cc_chef.py index a74c4d27..727769cd 100644 --- a/cloudinit/config/cc_chef.py +++ b/cloudinit/config/cc_chef.py @@ -40,8 +40,7 @@ OMNIBUS_URL = "https://www.opscode.com/chef/install.sh" def handle(name, cfg, cloud, log, _args): - if cloud.is_excluded(name): - return + # If there isn't a chef key in the configuration don't do anything if 'chef' not in cfg: log.debug(("Skipping module named %s," diff --git a/cloudinit/config/cc_emit_upstart.py b/cloudinit/config/cc_emit_upstart.py index 4392c1f5..5c2f6a31 100644 --- a/cloudinit/config/cc_emit_upstart.py +++ b/cloudinit/config/cc_emit_upstart.py @@ -29,7 +29,7 @@ distros = ['ubuntu', 'debian'] def handle(name, _cfg, cloud, log, args): - if cloud.is_excluded(name): + if cloud.distro.is_excluded(name): return event_names = args if not event_names: diff --git a/cloudinit/config/cc_grub_dpkg.py b/cloudinit/config/cc_grub_dpkg.py index ada0f472..3fd92426 100644 --- a/cloudinit/config/cc_grub_dpkg.py +++ b/cloudinit/config/cc_grub_dpkg.py @@ -30,7 +30,7 @@ def handle(_name, cfg, _cloud, log, _args): idevs = None idevs_empty = None - if _cloud.is_excluded(_name): + if _cloud.distro.is_excluded(_name): return if "grub-dpkg" in cfg: idevs = util.get_cfg_option_str(cfg["grub-dpkg"], diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py index ae47438a..c9563e25 100644 --- a/cloudinit/config/cc_keys_to_console.py +++ b/cloudinit/config/cc_keys_to_console.py @@ -30,7 +30,7 @@ HELPER_TOOL = '/usr/lib/cloud-init/write-ssh-key-fingerprints' def handle(name, cfg, _cloud, log, _args): - if _cloud.is_excluded(name): + if _cloud.distro.is_excluded(name): return if not os.path.exists(HELPER_TOOL): log.warn(("Unable to activate module %s," diff --git a/cloudinit/config/cc_landscape.py b/cloudinit/config/cc_landscape.py index 645b059d..8a709677 100644 --- a/cloudinit/config/cc_landscape.py +++ b/cloudinit/config/cc_landscape.py @@ -56,8 +56,6 @@ def handle(_name, cfg, cloud, log, _args): ls_cloudcfg = cfg.get("landscape", {}) - if cloud.is_excluded(_name): - return if not isinstance(ls_cloudcfg, (dict)): raise RuntimeError(("'landscape' key existed in config," " but not a dictionary type," diff --git a/cloudinit/config/cc_locale.py b/cloudinit/config/cc_locale.py index a3f0933a..68399993 100644 --- a/cloudinit/config/cc_locale.py +++ b/cloudinit/config/cc_locale.py @@ -22,8 +22,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, args): - if cloud.is_excluded(name): - return + if len(args) != 0: locale = args[0] else: diff --git a/cloudinit/config/cc_mcollective.py b/cloudinit/config/cc_mcollective.py index 76e149f5..b670390d 100644 --- a/cloudinit/config/cc_mcollective.py +++ b/cloudinit/config/cc_mcollective.py @@ -33,8 +33,7 @@ SERVER_CFG = '/etc/mcollective/server.cfg' def handle(name, cfg, cloud, log, _args): - if cloud.is_excluded(name): - return + # If there isn't a mcollective key in the configuration don't do anything if 'mcollective' not in cfg: log.debug(("Skipping module named %s, " diff --git a/cloudinit/config/cc_migrator.py b/cloudinit/config/cc_migrator.py index b9a012f5..f7b2211a 100644 --- a/cloudinit/config/cc_migrator.py +++ b/cloudinit/config/cc_migrator.py @@ -75,8 +75,7 @@ def _migrate_legacy_sems(cloud, log): def handle(name, cfg, cloud, log, _args): - if cloud.is_excluded(name): - return + 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 1476d19f..c1ac76d4 100644 --- a/cloudinit/config/cc_mounts.py +++ b/cloudinit/config/cc_mounts.py @@ -76,8 +76,7 @@ def sanitize_devname(startname, transformer, log): def handle(_name, cfg, cloud, log, _args): - if cloud.is_excluded(_name): - return + # 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 86e1d25b..85bc0240 100644 --- a/cloudinit/config/cc_package_update_upgrade_install.py +++ b/cloudinit/config/cc_package_update_upgrade_install.py @@ -49,8 +49,7 @@ def _fire_reboot(log, wait_attempts=6, initial_sleep=1, backoff=2): def handle(_name, cfg, cloud, log, _args): - if cloud.is_excluded(_name): - return + # 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 b2246807..360fd83e 100644 --- a/cloudinit/config/cc_phone_home.py +++ b/cloudinit/config/cc_phone_home.py @@ -44,8 +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 cloud.is_excluded(name): - return + if len(args) != 0: ph_cfg = util.read_conf(args[0]) else: diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index 12ac2b92..e3150808 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -31,8 +31,7 @@ EXIT_FAIL = 254 def handle(_name, cfg, _cloud, log, _args): - if _cloud.is_excluded(_name): - return + try: (args, timeout) = load_power_state(cfg) if args is None: diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index 73a9217a..43cc9307 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -52,8 +52,7 @@ NOBLOCK = "noblock" def handle(name, cfg, _cloud, log, args): - if _cloud.is_excluded(name): - return + 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 707402b7..feacebcd 100644 --- a/cloudinit/config/cc_resolv_conf.py +++ b/cloudinit/config/cc_resolv_conf.py @@ -92,8 +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 _cloud.is_excluded(name): - return + 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 b07e7a3e..f99524d1 100644 --- a/cloudinit/config/cc_rightscale_userdata.py +++ b/cloudinit/config/cc_rightscale_userdata.py @@ -50,8 +50,7 @@ MY_HOOKNAME = 'CLOUD_INIT_REMOTE_HOOK' def handle(name, _cfg, cloud, log, _args): - if cloud.is_excluded(name): - return + try: ud = cloud.get_userdata_raw() except: diff --git a/cloudinit/config/cc_rsyslog.py b/cloudinit/config/cc_rsyslog.py index 89587d9f..7f70167e 100644 --- a/cloudinit/config/cc_rsyslog.py +++ b/cloudinit/config/cc_rsyslog.py @@ -35,8 +35,7 @@ def handle(name, cfg, cloud, log, _args): # *.* @@syslogd.example.com # process 'rsyslog' - if cloud.is_excluded(name): - return + 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 307e6a48..b48762c8 100644 --- a/cloudinit/config/cc_salt_minion.py +++ b/cloudinit/config/cc_salt_minion.py @@ -22,8 +22,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, _args): - if cloud.is_excluded(name): - return + # 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_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py index 93b570a0..f63e3e08 100644 --- a/cloudinit/config/cc_yum_add_repo.py +++ b/cloudinit/config/cc_yum_add_repo.py @@ -58,7 +58,7 @@ def _format_repository_config(repo_id, repo_config): def handle(name, cfg, _cloud, log, _args): - if _cloud.is_excluded(name): + if _cloud.distro.is_excluded(name): return repos = cfg.get('yum_repos') if not repos: |