summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/config/cc_apt_pipelining.py2
-rwxr-xr-xcloudinit/config/cc_byobu.py6
-rw-r--r--cloudinit/config/cc_chef.py20
-rw-r--r--cloudinit/config/cc_emit_upstart.py2
-rw-r--r--cloudinit/config/cc_final_message.py2
-rw-r--r--cloudinit/config/cc_growpart.py2
-rw-r--r--cloudinit/config/cc_keys_to_console.py6
-rw-r--r--cloudinit/config/cc_lxd.py15
-rw-r--r--cloudinit/config/cc_mounts.py14
-rw-r--r--cloudinit/config/cc_package_update_upgrade_install.py7
-rw-r--r--cloudinit/config/cc_phone_home.py12
-rw-r--r--cloudinit/config/cc_power_state_change.py13
-rw-r--r--cloudinit/config/cc_puppet.py10
-rw-r--r--cloudinit/config/cc_resizefs.py17
-rw-r--r--cloudinit/config/cc_resolv_conf.py4
-rw-r--r--cloudinit/config/cc_rightscale_userdata.py4
-rw-r--r--cloudinit/config/cc_rsyslog.py2
-rw-r--r--cloudinit/config/cc_scripts_per_boot.py4
-rw-r--r--cloudinit/config/cc_scripts_per_instance.py4
-rw-r--r--cloudinit/config/cc_scripts_per_once.py4
-rw-r--r--cloudinit/config/cc_scripts_user.py4
-rw-r--r--cloudinit/config/cc_scripts_vendor.py4
-rw-r--r--cloudinit/config/cc_seed_random.py2
-rwxr-xr-xcloudinit/config/cc_set_passwords.py2
-rw-r--r--cloudinit/config/cc_update_etc_hosts.py8
-rw-r--r--cloudinit/config/cc_yum_add_repo.py10
-rw-r--r--tests/unittests/test_handler/test_handler_power_state.py2
27 files changed, 90 insertions, 92 deletions
diff --git a/cloudinit/config/cc_apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py
index 459332ab..225d0905 100644
--- a/cloudinit/config/cc_apt_pipelining.py
+++ b/cloudinit/config/cc_apt_pipelining.py
@@ -59,7 +59,7 @@ def handle(_name, cfg, _cloud, log, _args):
elif apt_pipe_value_s in [str(b) for b in range(0, 6)]:
write_apt_snippet(apt_pipe_value_s, log, DEFAULT_FILE)
else:
- log.warn("Invalid option for apt_pipelining: %s", apt_pipe_value)
+ log.warning("Invalid option for apt_pipelining: %s", apt_pipe_value)
def write_apt_snippet(setting, log, f_name):
diff --git a/cloudinit/config/cc_byobu.py b/cloudinit/config/cc_byobu.py
index 8570da15..0b4352c8 100755
--- a/cloudinit/config/cc_byobu.py
+++ b/cloudinit/config/cc_byobu.py
@@ -60,7 +60,7 @@ def handle(name, cfg, cloud, log, args):
valid = ("enable-user", "enable-system", "enable",
"disable-user", "disable-system", "disable")
if value not in valid:
- log.warn("Unknown value %s for byobu_by_default", value)
+ log.warning("Unknown value %s for byobu_by_default", value)
mod_user = value.endswith("-user")
mod_sys = value.endswith("-system")
@@ -80,8 +80,8 @@ def handle(name, cfg, cloud, log, args):
(users, _groups) = ug_util.normalize_users_groups(cfg, cloud.distro)
(user, _user_config) = ug_util.extract_default(users)
if not user:
- log.warn(("No default byobu user provided, "
- "can not launch %s for the default user"), bl_inst)
+ log.warning(("No default byobu user provided, "
+ "can not launch %s for the default user"), bl_inst)
else:
shcmd += " sudo -Hu \"%s\" byobu-launcher-%s" % (user, bl_inst)
shcmd += " || X=$(($X+1)); "
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
index a6240306..0ad6b7f1 100644
--- a/cloudinit/config/cc_chef.py
+++ b/cloudinit/config/cc_chef.py
@@ -196,7 +196,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 module named %s,"
- " no 'chef' key in configuration"), name)
+ " no 'chef' key in configuration"), name)
return
chef_cfg = cfg['chef']
@@ -215,9 +215,9 @@ def handle(name, cfg, cloud, log, _args):
if vcert != "system":
util.write_file(vkey_path, vcert)
elif not os.path.isfile(vkey_path):
- log.warn("chef validation_cert provided as 'system', but "
- "validation_key path '%s' does not exist.",
- vkey_path)
+ log.warning("chef validation_cert provided as 'system', but "
+ "validation_key path '%s' does not exist.",
+ vkey_path)
# Create the chef config from template
template_fn = cloud.get_template_filename('chef_client.rb')
@@ -234,8 +234,8 @@ def handle(name, cfg, cloud, log, _args):
util.ensure_dirs(param_paths)
templater.render_to_file(template_fn, CHEF_RB_PATH, params)
else:
- log.warn("No template found, not rendering to %s",
- CHEF_RB_PATH)
+ log.warning("No template found, not rendering to %s",
+ CHEF_RB_PATH)
# Set the firstboot json
fb_filename = util.get_cfg_option_str(chef_cfg, 'firstboot_path',
@@ -276,9 +276,9 @@ def run_chef(chef_cfg, log):
elif isinstance(cmd_args, six.string_types):
cmd.append(cmd_args)
else:
- log.warn("Unknown type %s provided for chef"
- " 'exec_arguments' expected list, tuple,"
- " or string", type(cmd_args))
+ log.warning("Unknown type %s provided for chef"
+ " 'exec_arguments' expected list, tuple,"
+ " or string", type(cmd_args))
cmd.extend(CHEF_EXEC_DEF_ARGS)
else:
cmd.extend(CHEF_EXEC_DEF_ARGS)
@@ -334,7 +334,7 @@ def install_chef(cloud, chef_cfg, log):
retries=util.get_cfg_option_int(chef_cfg, "omnibus_url_retries"),
omnibus_version=omnibus_version)
else:
- log.warn("Unknown chef install type '%s'", install_type)
+ log.warning("Unknown chef install type '%s'", install_type)
run = False
return run
diff --git a/cloudinit/config/cc_emit_upstart.py b/cloudinit/config/cc_emit_upstart.py
index eb9fbe66..b342e04d 100644
--- a/cloudinit/config/cc_emit_upstart.py
+++ b/cloudinit/config/cc_emit_upstart.py
@@ -69,6 +69,6 @@ def handle(name, _cfg, cloud, log, args):
util.subp(cmd)
except Exception as e:
# TODO(harlowja), use log exception from utils??
- log.warn("Emission of upstart event %s failed due to: %s", n, e)
+ log.warning("Emission of upstart event %s failed due to: %s", n, e)
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_final_message.py b/cloudinit/config/cc_final_message.py
index c61f03d4..fd141541 100644
--- a/cloudinit/config/cc_final_message.py
+++ b/cloudinit/config/cc_final_message.py
@@ -83,6 +83,6 @@ def handle(_name, cfg, cloud, log, args):
util.logexc(log, "Failed to write boot finished file %s", boot_fin_fn)
if cloud.datasource.is_disconnected:
- log.warn("Used fallback datasource")
+ log.warning("Used fallback datasource")
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index 564f376f..aa9716e7 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -321,7 +321,7 @@ def handle(_name, cfg, _cloud, log, _args):
mycfg = cfg.get('growpart')
if not isinstance(mycfg, dict):
- log.warn("'growpart' in config was not a dict")
+ log.warning("'growpart' in config was not a dict")
return
mode = mycfg.get('mode', "auto")
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index aff4010e..8f8735ce 100644
--- a/cloudinit/config/cc_keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
@@ -52,8 +52,8 @@ def _get_helper_tool_path(distro):
def handle(name, cfg, cloud, log, _args):
helper_path = _get_helper_tool_path(cloud.distro)
if not os.path.exists(helper_path):
- log.warn(("Unable to activate module %s,"
- " helper tool not found at %s"), name, helper_path)
+ log.warning(("Unable to activate module %s,"
+ " helper tool not found at %s"), name, helper_path)
return
fp_blacklist = util.get_cfg_option_list(cfg,
@@ -68,7 +68,7 @@ def handle(name, cfg, cloud, log, _args):
util.multi_log("%s\n" % (stdout.strip()),
stderr=False, console=True)
except Exception:
- log.warn("Writing keys to the system console failed!")
+ log.warning("Writing keys to the system console failed!")
raise
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py
index d9830770..151a9844 100644
--- a/cloudinit/config/cc_lxd.py
+++ b/cloudinit/config/cc_lxd.py
@@ -66,21 +66,21 @@ def handle(name, cfg, cloud, log, args):
name)
return
if not isinstance(lxd_cfg, dict):
- log.warn("lxd config must be a dictionary. found a '%s'",
- type(lxd_cfg))
+ log.warning("lxd config must be a dictionary. found a '%s'",
+ type(lxd_cfg))
return
# Grab the configuration
init_cfg = lxd_cfg.get('init')
if not isinstance(init_cfg, dict):
- log.warn("lxd/init config must be a dictionary. found a '%s'",
- type(init_cfg))
+ log.warning("lxd/init config must be a dictionary. found a '%s'",
+ type(init_cfg))
init_cfg = {}
bridge_cfg = lxd_cfg.get('bridge', {})
if not isinstance(bridge_cfg, dict):
- log.warn("lxd/bridge config must be a dictionary. found a '%s'",
- type(bridge_cfg))
+ log.warning("lxd/bridge config must be a dictionary. found a '%s'",
+ type(bridge_cfg))
bridge_cfg = {}
# Install the needed packages
@@ -95,7 +95,7 @@ def handle(name, cfg, cloud, log, args):
try:
cloud.distro.install_packages(packages)
except util.ProcessExecutionError as exc:
- log.warn("failed to install packages %s: %s", packages, exc)
+ log.warning("failed to install packages %s: %s", packages, exc)
return
# Set up lxd if init config is given
@@ -301,5 +301,4 @@ def maybe_cleanup_default(net_name, did_init, create, attach,
raise e
LOG.debug(msg, nic_name, profile, fail_assume_enoent)
-
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 123ffb84..c741c746 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -251,10 +251,10 @@ def setup_swapfile(fname, size=None, maxsize=None):
util.ensure_dir(tdir)
util.log_time(LOG.debug, msg, func=util.subp,
args=[['sh', '-c',
- ('rm -f "$1" && umask 0066 && '
- '{ fallocate -l "${2}M" "$1" || '
- ' dd if=/dev/zero "of=$1" bs=1M "count=$2"; } && '
- 'mkswap "$1" || { r=$?; rm -f "$1"; exit $r; }'),
+ ('rm -f "$1" && umask 0066 && '
+ '{ fallocate -l "${2}M" "$1" || '
+ 'dd if=/dev/zero "of=$1" bs=1M "count=$2"; } && '
+ 'mkswap "$1" || { r=$?; rm -f "$1"; exit $r; }'),
'setup_swap', fname, mbsize]])
except Exception as e:
@@ -347,8 +347,8 @@ def handle(_name, cfg, cloud, log, _args):
for i in range(len(cfgmnt)):
# skip something that wasn't a list
if not isinstance(cfgmnt[i], list):
- log.warn("Mount option %s not a list, got a %s instead",
- (i + 1), type_utils.obj_name(cfgmnt[i]))
+ log.warning("Mount option %s not a list, got a %s instead",
+ (i + 1), type_utils.obj_name(cfgmnt[i]))
continue
start = str(cfgmnt[i][0])
@@ -495,7 +495,7 @@ def handle(_name, cfg, cloud, log, _args):
util.subp(cmd)
log.debug(fmt, "PASS")
except util.ProcessExecutionError:
- log.warn(fmt, "FAIL")
+ log.warning(fmt, "FAIL")
util.logexc(log, fmt, "FAIL")
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_package_update_upgrade_install.py b/cloudinit/config/cc_package_update_upgrade_install.py
index 17b91011..86afffef 100644
--- a/cloudinit/config/cc_package_update_upgrade_install.py
+++ b/cloudinit/config/cc_package_update_upgrade_install.py
@@ -108,7 +108,8 @@ def handle(_name, cfg, cloud, log, _args):
reboot_fn_exists = os.path.isfile(REBOOT_FILE)
if (upgrade or pkglist) and reboot_if_required and reboot_fn_exists:
try:
- log.warn("Rebooting after upgrade or install per %s", REBOOT_FILE)
+ log.warning("Rebooting after upgrade or install per "
+ "%s", REBOOT_FILE)
# Flush the above warning + anything else out...
logging.flushLoggers(log)
_fire_reboot(log)
@@ -117,8 +118,8 @@ def handle(_name, cfg, cloud, log, _args):
errors.append(e)
if len(errors):
- log.warn("%s failed with exceptions, re-raising the last one",
- len(errors))
+ log.warning("%s failed with exceptions, re-raising the last one",
+ len(errors))
raise errors[-1]
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py
index 3be0d1c1..b8e27090 100644
--- a/cloudinit/config/cc_phone_home.py
+++ b/cloudinit/config/cc_phone_home.py
@@ -79,8 +79,8 @@ def handle(name, cfg, cloud, log, args):
ph_cfg = cfg['phone_home']
if 'url' not in ph_cfg:
- log.warn(("Skipping module named %s, "
- "no 'url' found in 'phone_home' configuration"), name)
+ log.warning(("Skipping module named %s, "
+ "no 'url' found in 'phone_home' configuration"), name)
return
url = ph_cfg['url']
@@ -91,7 +91,7 @@ def handle(name, cfg, cloud, log, args):
except Exception:
tries = 10
util.logexc(log, "Configuration entry 'tries' is not an integer, "
- "using %s instead", tries)
+ "using %s instead", tries)
if post_list == "all":
post_list = POST_LIST_ALL
@@ -112,7 +112,7 @@ def handle(name, cfg, cloud, log, args):
all_keys[n] = util.load_file(path)
except Exception:
util.logexc(log, "%s: failed to open, can not phone home that "
- "data!", path)
+ "data!", path)
submit_keys = {}
for k in post_list:
@@ -120,8 +120,8 @@ def handle(name, cfg, cloud, log, args):
submit_keys[k] = all_keys[k]
else:
submit_keys[k] = None
- log.warn(("Requested key %s from 'post'"
- " configuration list not available"), k)
+ log.warning(("Requested key %s from 'post'"
+ " configuration list not available"), k)
# Get them read to be posted
real_submit_keys = {}
diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py
index 50b37470..43a479cf 100644
--- a/cloudinit/config/cc_power_state_change.py
+++ b/cloudinit/config/cc_power_state_change.py
@@ -103,24 +103,23 @@ def check_condition(cond, log=None):
return False
else:
if log:
- log.warn(pre + "unexpected exit %s. " % ret +
- "do not apply change.")
+ log.warning(pre + "unexpected exit %s. " % ret +
+ "do not apply change.")
return False
except Exception as e:
if log:
- log.warn(pre + "Unexpected error: %s" % e)
+ log.warning(pre + "Unexpected error: %s" % e)
return False
def handle(_name, cfg, _cloud, log, _args):
-
try:
(args, timeout, condition) = load_power_state(cfg)
if args is None:
log.debug("no power_state provided. doing nothing")
return
except Exception as e:
- log.warn("%s Not performing power state change!" % str(e))
+ log.warning("%s Not performing power state change!" % str(e))
return
if condition is False:
@@ -131,7 +130,7 @@ def handle(_name, cfg, _cloud, log, _args):
cmdline = givecmdline(mypid)
if not cmdline:
- log.warn("power_state: failed to get cmdline of current process")
+ log.warning("power_state: failed to get cmdline of current process")
return
devnull_fp = open(os.devnull, "w")
@@ -214,7 +213,7 @@ def run_after_pid_gone(pid, pidcmdline, timeout, log, condition, func, args):
def fatal(msg):
if log:
- log.warn(msg)
+ log.warning(msg)
doexit(EXIT_FAIL)
known_errnos = (errno.ENOENT, errno.ESRCH)
diff --git a/cloudinit/config/cc_puppet.py b/cloudinit/config/cc_puppet.py
index 4190a20b..e26712e0 100644
--- a/cloudinit/config/cc_puppet.py
+++ b/cloudinit/config/cc_puppet.py
@@ -98,8 +98,8 @@ def _autostart_puppet(log):
elif os.path.exists('/sbin/chkconfig'):
util.subp(['/sbin/chkconfig', 'puppet', 'on'], capture=False)
else:
- log.warn(("Sorry we do not know how to enable"
- " puppet services on this system"))
+ log.warning(("Sorry we do not know how to enable"
+ " puppet services on this system"))
def handle(name, cfg, cloud, log, _args):
@@ -121,8 +121,8 @@ def handle(name, cfg, cloud, log, _args):
p_constants = PuppetConstants(conf_file, ssl_dir, log)
if not install and version:
- log.warn(("Puppet install set false but version supplied,"
- " doing nothing."))
+ log.warning(("Puppet install set false but version supplied,"
+ " doing nothing."))
elif install:
log.debug(("Attempting to install puppet %s,"),
version if version else 'latest')
@@ -141,7 +141,7 @@ def handle(name, cfg, cloud, log, _args):
cleaned_lines = [i.lstrip() for i in contents.splitlines()]
cleaned_contents = '\n'.join(cleaned_lines)
# Move to puppet_config.read_file when dropping py2.7
- puppet_config.readfp( # pylint: disable=W1505
+ puppet_config.readfp( # pylint: disable=W1505
StringIO(cleaned_contents),
filename=p_constants.conf_path)
for (cfg_name, cfg) in puppet_cfg['conf'].items():
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index afd2e060..01dfc125 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -8,7 +8,6 @@
"""Resizefs: cloud-config module which resizes the filesystem"""
-
import errno
import getopt
import os
@@ -183,7 +182,7 @@ def maybe_get_writable_device_path(devpath, info, log):
not container):
devpath = util.rootdev_from_cmdline(util.get_cmdline())
if devpath is None:
- log.warn("Unable to find device '/dev/root'")
+ log.warning("Unable to find device '/dev/root'")
return None
log.debug("Converted /dev/root to '%s' per kernel cmdline", devpath)
@@ -212,8 +211,8 @@ def maybe_get_writable_device_path(devpath, info, log):
log.debug("Device '%s' did not exist in container. "
"cannot resize: %s", devpath, info)
elif exc.errno == errno.ENOENT:
- log.warn("Device '%s' did not exist. cannot resize: %s",
- devpath, info)
+ log.warning("Device '%s' did not exist. cannot resize: %s",
+ devpath, info)
else:
raise exc
return None
@@ -223,8 +222,8 @@ def maybe_get_writable_device_path(devpath, info, log):
log.debug("device '%s' not a block device in container."
" cannot resize: %s" % (devpath, info))
else:
- log.warn("device '%s' not a block device. cannot resize: %s" %
- (devpath, info))
+ log.warning("device '%s' not a block device. cannot resize: %s" %
+ (devpath, info))
return None
return devpath # The writable block devpath
@@ -243,7 +242,7 @@ def handle(name, cfg, _cloud, log, args):
resize_what = "/"
result = util.get_mount_info(resize_what, log)
if not result:
- log.warn("Could not determine filesystem type of %s", resize_what)
+ log.warning("Could not determine filesystem type of %s", resize_what)
return
(devpth, fs_type, mount_point) = result
@@ -280,8 +279,8 @@ def handle(name, cfg, _cloud, log, args):
break
if not resizer:
- log.warn("Not resizing unknown filesystem type %s for %s",
- fs_type, resize_what)
+ log.warning("Not resizing unknown filesystem type %s for %s",
+ fs_type, resize_what)
return
resize_cmd = resizer(resize_what, devpth)
diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py
index 9812562a..69f4768a 100644
--- a/cloudinit/config/cc_resolv_conf.py
+++ b/cloudinit/config/cc_resolv_conf.py
@@ -102,11 +102,11 @@ def handle(name, cfg, cloud, log, _args):
return
if "resolv_conf" not in cfg:
- log.warn("manage_resolv_conf True but no parameters provided!")
+ log.warning("manage_resolv_conf True but no parameters provided!")
template_fn = cloud.get_template_filename('resolv.conf')
if not template_fn:
- log.warn("No template found, not rendering /etc/resolv.conf")
+ log.warning("No template found, not rendering /etc/resolv.conf")
return
generate_resolv_conf(template_fn=template_fn, params=cfg["resolv_conf"])
diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
index 4e34c7e9..bd8ee89f 100644
--- a/cloudinit/config/cc_rightscale_userdata.py
+++ b/cloudinit/config/cc_rightscale_userdata.py
@@ -111,8 +111,8 @@ def handle(name, _cfg, cloud, log, _args):
log.debug("%s urls were skipped or failed", skipped)
if captured_excps:
- log.warn("%s failed with exceptions, re-raising the last one",
- len(captured_excps))
+ log.warning("%s failed with exceptions, re-raising the last one",
+ len(captured_excps))
raise captured_excps[-1]
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_rsyslog.py b/cloudinit/config/cc_rsyslog.py
index 22b17532..ff211f65 100644
--- a/cloudinit/config/cc_rsyslog.py
+++ b/cloudinit/config/cc_rsyslog.py
@@ -432,7 +432,7 @@ def handle(name, cfg, cloud, log, _args):
systemd=cloud.distro.uses_systemd()),
except util.ProcessExecutionError as e:
restarted = False
- log.warn("Failed to reload syslog", e)
+ log.warning("Failed to reload syslog", e)
if restarted:
# This only needs to run if we *actually* restarted
diff --git a/cloudinit/config/cc_scripts_per_boot.py b/cloudinit/config/cc_scripts_per_boot.py
index b03255c7..588e1b03 100644
--- a/cloudinit/config/cc_scripts_per_boot.py
+++ b/cloudinit/config/cc_scripts_per_boot.py
@@ -40,8 +40,8 @@ def handle(name, _cfg, cloud, log, _args):
try:
util.runparts(runparts_path)
except Exception:
- log.warn("Failed to run module %s (%s in %s)",
- name, SCRIPT_SUBDIR, runparts_path)
+ log.warning("Failed to run module %s (%s in %s)",
+ name, SCRIPT_SUBDIR, runparts_path)
raise
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_scripts_per_instance.py b/cloudinit/config/cc_scripts_per_instance.py
index baee5cc4..2bc8a6ef 100644
--- a/cloudinit/config/cc_scripts_per_instance.py
+++ b/cloudinit/config/cc_scripts_per_instance.py
@@ -40,8 +40,8 @@ def handle(name, _cfg, cloud, log, _args):
try:
util.runparts(runparts_path)
except Exception:
- log.warn("Failed to run module %s (%s in %s)",
- name, SCRIPT_SUBDIR, runparts_path)
+ log.warning("Failed to run module %s (%s in %s)",
+ name, SCRIPT_SUBDIR, runparts_path)
raise
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_scripts_per_once.py b/cloudinit/config/cc_scripts_per_once.py
index 4943e9aa..3f27ee34 100644
--- a/cloudinit/config/cc_scripts_per_once.py
+++ b/cloudinit/config/cc_scripts_per_once.py
@@ -40,8 +40,8 @@ def handle(name, _cfg, cloud, log, _args):
try:
util.runparts(runparts_path)
except Exception:
- log.warn("Failed to run module %s (%s in %s)",
- name, SCRIPT_SUBDIR, runparts_path)
+ log.warning("Failed to run module %s (%s in %s)",
+ name, SCRIPT_SUBDIR, runparts_path)
raise
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_scripts_user.py b/cloudinit/config/cc_scripts_user.py
index 6c66481e..d940dbd6 100644
--- a/cloudinit/config/cc_scripts_user.py
+++ b/cloudinit/config/cc_scripts_user.py
@@ -44,8 +44,8 @@ def handle(name, _cfg, cloud, log, _args):
try:
util.runparts(runparts_path)
except Exception:
- log.warn("Failed to run module %s (%s in %s)",
- name, SCRIPT_SUBDIR, runparts_path)
+ log.warning("Failed to run module %s (%s in %s)",
+ name, SCRIPT_SUBDIR, runparts_path)
raise
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_scripts_vendor.py b/cloudinit/config/cc_scripts_vendor.py
index 0292eafb..faac9242 100644
--- a/cloudinit/config/cc_scripts_vendor.py
+++ b/cloudinit/config/cc_scripts_vendor.py
@@ -48,8 +48,8 @@ def handle(name, cfg, cloud, log, _args):
try:
util.runparts(runparts_path, exe_prefix=prefix)
except Exception:
- log.warn("Failed to run module %s (%s in %s)",
- name, SCRIPT_SUBDIR, runparts_path)
+ log.warning("Failed to run module %s (%s in %s)",
+ name, SCRIPT_SUBDIR, runparts_path)
raise
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_seed_random.py b/cloudinit/config/cc_seed_random.py
index 65f6e777..a5d7c73f 100644
--- a/cloudinit/config/cc_seed_random.py
+++ b/cloudinit/config/cc_seed_random.py
@@ -131,7 +131,7 @@ def handle(name, cfg, cloud, log, _args):
env['RANDOM_SEED_FILE'] = seed_path
handle_random_seed_command(command=command, required=req, env=env)
except ValueError as e:
- log.warn("handling random command [%s] failed: %s", command, e)
+ log.warning("handling random command [%s] failed: %s", command, e)
raise e
# vi: ts=4 expandtab
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index cf9b5ab5..1379428d 100755
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -164,7 +164,7 @@ def handle(_name, cfg, cloud, log, args):
if user:
plist = ["%s:%s" % (user, password)]
else:
- log.warn("No default or defined user to change password for.")
+ log.warning("No default or defined user to change password for.")
errors = []
if plist:
diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py
index c96eede1..03fffb96 100644
--- a/cloudinit/config/cc_update_etc_hosts.py
+++ b/cloudinit/config/cc_update_etc_hosts.py
@@ -62,8 +62,8 @@ def handle(name, cfg, cloud, log, _args):
if util.translate_bool(manage_hosts, addons=['template']):
(hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
if not hostname:
- log.warn(("Option 'manage_etc_hosts' was set,"
- " but no hostname was found"))
+ log.warning(("Option 'manage_etc_hosts' was set,"
+ " but no hostname was found"))
return
# Render from a template file
@@ -80,8 +80,8 @@ def handle(name, cfg, cloud, log, _args):
elif manage_hosts == "localhost":
(hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
if not hostname:
- log.warn(("Option 'manage_etc_hosts' was set,"
- " but no hostname was found"))
+ log.warning(("Option 'manage_etc_hosts' was set,"
+ " but no hostname was found"))
return
log.debug("Managing localhost in /etc/hosts")
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index 6a42f499..3b354a7d 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -113,16 +113,16 @@ def handle(name, cfg, _cloud, log, _args):
missing_required = 0
for req_field in ['baseurl']:
if req_field not in repo_config:
- log.warn(("Repository %s does not contain a %s"
- " configuration 'required' entry"),
- repo_id, req_field)
+ log.warning(("Repository %s does not contain a %s"
+ " configuration 'required' entry"),
+ repo_id, req_field)
missing_required += 1
if not missing_required:
repo_configs[canon_repo_id] = repo_config
repo_locations[canon_repo_id] = repo_fn_pth
else:
- log.warn("Repository %s is missing %s required fields, skipping!",
- repo_id, missing_required)
+ log.warning("Repository %s is missing %s required fields, "
+ "skipping!", repo_id, missing_required)
for (c_repo_id, path) in repo_locations.items():
repo_blob = _format_repository_config(c_repo_id,
repo_configs.get(c_repo_id))
diff --git a/tests/unittests/test_handler/test_handler_power_state.py b/tests/unittests/test_handler/test_handler_power_state.py
index 3c726422..0d8d17b9 100644
--- a/tests/unittests/test_handler/test_handler_power_state.py
+++ b/tests/unittests/test_handler/test_handler_power_state.py
@@ -90,7 +90,7 @@ class TestCheckCondition(t_help.TestCase):
mocklog = mock.Mock()
self.assertEqual(
psc.check_condition(self.cmd_with_exit(2), mocklog), False)
- self.assertEqual(mocklog.warn.call_count, 1)
+ self.assertEqual(mocklog.warning.call_count, 1)
def check_lps_ret(psc_return, mode=None):