Merge ~d-info-e/cloud-init:fix-log-warn into cloud-init:master

Proposed by do3meli
Status: Merged
Approved by: Dan Watkins
Approved revision: d15d8b70187fbfe0cf04b1176e2ff2a2cfdcd8f8
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~d-info-e/cloud-init:fix-log-warn
Merge into: cloud-init:master
Diff against target: 673 lines (+90/-92)
27 files modified
cloudinit/config/cc_apt_pipelining.py (+1/-1)
cloudinit/config/cc_byobu.py (+3/-3)
cloudinit/config/cc_chef.py (+10/-10)
cloudinit/config/cc_emit_upstart.py (+1/-1)
cloudinit/config/cc_final_message.py (+1/-1)
cloudinit/config/cc_growpart.py (+1/-1)
cloudinit/config/cc_keys_to_console.py (+3/-3)
cloudinit/config/cc_lxd.py (+7/-8)
cloudinit/config/cc_mounts.py (+7/-7)
cloudinit/config/cc_package_update_upgrade_install.py (+4/-3)
cloudinit/config/cc_phone_home.py (+6/-6)
cloudinit/config/cc_power_state_change.py (+6/-7)
cloudinit/config/cc_puppet.py (+5/-5)
cloudinit/config/cc_resizefs.py (+8/-9)
cloudinit/config/cc_resolv_conf.py (+2/-2)
cloudinit/config/cc_rightscale_userdata.py (+2/-2)
cloudinit/config/cc_rsyslog.py (+1/-1)
cloudinit/config/cc_scripts_per_boot.py (+2/-2)
cloudinit/config/cc_scripts_per_instance.py (+2/-2)
cloudinit/config/cc_scripts_per_once.py (+2/-2)
cloudinit/config/cc_scripts_user.py (+2/-2)
cloudinit/config/cc_scripts_vendor.py (+2/-2)
cloudinit/config/cc_seed_random.py (+1/-1)
cloudinit/config/cc_set_passwords.py (+1/-1)
cloudinit/config/cc_update_etc_hosts.py (+4/-4)
cloudinit/config/cc_yum_add_repo.py (+5/-5)
tests/unittests/test_handler/test_handler_power_state.py (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Review via email: mp+374215@code.launchpad.net

Commit message

replace any deprecated log.warn with log.warning

Commit 6797e822959b84c98cf73e02b2a6e3d6ab3fd4fe replaced
the LOG.warn calls that linters were warning about; this
also replaces calls that linters would not have recognised
(as `log` is generally a parameter in these scenarios).

LP: #1508442

To post a comment you must log in.
~d-info-e/cloud-init:fix-log-warn updated
618136a... by do3meli

fix line lenght

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:618136a3309ad961c94b95aacb4c2a590be67cb1
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1210/
Executed test runs:
    FAILED: Checkout

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1210//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:618136a3309ad961c94b95aacb4c2a590be67cb1
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1211/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1211//rebuild

review: Needs Fixing (continuous-integration)
~d-info-e/cloud-init:fix-log-warn updated
18c791b... by do3meli

fix test

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:618136a3309ad961c94b95aacb4c2a590be67cb1
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1212/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1212//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Dan Watkins (oddbloke) wrote :

The lint failures from the previous run were not addressed; that's what's failing here, too.

~d-info-e/cloud-init:fix-log-warn updated
d15d8b7... by do3meli

fix outstanding pycodestyle issues

Revision history for this message
do3meli (d-info-e) wrote :

hi dan,
i have fixed the outstanding pycodestyle issues i found in my local env.
please kick in another CI run.
cheers, dom

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:618136a3309ad961c94b95aacb4c2a590be67cb1
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1213/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1213//rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/config/cc_apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py
2index 459332a..225d090 100644
3--- a/cloudinit/config/cc_apt_pipelining.py
4+++ b/cloudinit/config/cc_apt_pipelining.py
5@@ -59,7 +59,7 @@ def handle(_name, cfg, _cloud, log, _args):
6 elif apt_pipe_value_s in [str(b) for b in range(0, 6)]:
7 write_apt_snippet(apt_pipe_value_s, log, DEFAULT_FILE)
8 else:
9- log.warn("Invalid option for apt_pipelining: %s", apt_pipe_value)
10+ log.warning("Invalid option for apt_pipelining: %s", apt_pipe_value)
11
12
13 def write_apt_snippet(setting, log, f_name):
14diff --git a/cloudinit/config/cc_byobu.py b/cloudinit/config/cc_byobu.py
15index 8570da1..0b4352c 100755
16--- a/cloudinit/config/cc_byobu.py
17+++ b/cloudinit/config/cc_byobu.py
18@@ -60,7 +60,7 @@ def handle(name, cfg, cloud, log, args):
19 valid = ("enable-user", "enable-system", "enable",
20 "disable-user", "disable-system", "disable")
21 if value not in valid:
22- log.warn("Unknown value %s for byobu_by_default", value)
23+ log.warning("Unknown value %s for byobu_by_default", value)
24
25 mod_user = value.endswith("-user")
26 mod_sys = value.endswith("-system")
27@@ -80,8 +80,8 @@ def handle(name, cfg, cloud, log, args):
28 (users, _groups) = ug_util.normalize_users_groups(cfg, cloud.distro)
29 (user, _user_config) = ug_util.extract_default(users)
30 if not user:
31- log.warn(("No default byobu user provided, "
32- "can not launch %s for the default user"), bl_inst)
33+ log.warning(("No default byobu user provided, "
34+ "can not launch %s for the default user"), bl_inst)
35 else:
36 shcmd += " sudo -Hu \"%s\" byobu-launcher-%s" % (user, bl_inst)
37 shcmd += " || X=$(($X+1)); "
38diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
39index a624030..0ad6b7f 100644
40--- a/cloudinit/config/cc_chef.py
41+++ b/cloudinit/config/cc_chef.py
42@@ -196,7 +196,7 @@ def handle(name, cfg, cloud, log, _args):
43 # If there isn't a chef key in the configuration don't do anything
44 if 'chef' not in cfg:
45 log.debug(("Skipping module named %s,"
46- " no 'chef' key in configuration"), name)
47+ " no 'chef' key in configuration"), name)
48 return
49 chef_cfg = cfg['chef']
50
51@@ -215,9 +215,9 @@ def handle(name, cfg, cloud, log, _args):
52 if vcert != "system":
53 util.write_file(vkey_path, vcert)
54 elif not os.path.isfile(vkey_path):
55- log.warn("chef validation_cert provided as 'system', but "
56- "validation_key path '%s' does not exist.",
57- vkey_path)
58+ log.warning("chef validation_cert provided as 'system', but "
59+ "validation_key path '%s' does not exist.",
60+ vkey_path)
61
62 # Create the chef config from template
63 template_fn = cloud.get_template_filename('chef_client.rb')
64@@ -234,8 +234,8 @@ def handle(name, cfg, cloud, log, _args):
65 util.ensure_dirs(param_paths)
66 templater.render_to_file(template_fn, CHEF_RB_PATH, params)
67 else:
68- log.warn("No template found, not rendering to %s",
69- CHEF_RB_PATH)
70+ log.warning("No template found, not rendering to %s",
71+ CHEF_RB_PATH)
72
73 # Set the firstboot json
74 fb_filename = util.get_cfg_option_str(chef_cfg, 'firstboot_path',
75@@ -276,9 +276,9 @@ def run_chef(chef_cfg, log):
76 elif isinstance(cmd_args, six.string_types):
77 cmd.append(cmd_args)
78 else:
79- log.warn("Unknown type %s provided for chef"
80- " 'exec_arguments' expected list, tuple,"
81- " or string", type(cmd_args))
82+ log.warning("Unknown type %s provided for chef"
83+ " 'exec_arguments' expected list, tuple,"
84+ " or string", type(cmd_args))
85 cmd.extend(CHEF_EXEC_DEF_ARGS)
86 else:
87 cmd.extend(CHEF_EXEC_DEF_ARGS)
88@@ -334,7 +334,7 @@ def install_chef(cloud, chef_cfg, log):
89 retries=util.get_cfg_option_int(chef_cfg, "omnibus_url_retries"),
90 omnibus_version=omnibus_version)
91 else:
92- log.warn("Unknown chef install type '%s'", install_type)
93+ log.warning("Unknown chef install type '%s'", install_type)
94 run = False
95 return run
96
97diff --git a/cloudinit/config/cc_emit_upstart.py b/cloudinit/config/cc_emit_upstart.py
98index eb9fbe6..b342e04 100644
99--- a/cloudinit/config/cc_emit_upstart.py
100+++ b/cloudinit/config/cc_emit_upstart.py
101@@ -69,6 +69,6 @@ def handle(name, _cfg, cloud, log, args):
102 util.subp(cmd)
103 except Exception as e:
104 # TODO(harlowja), use log exception from utils??
105- log.warn("Emission of upstart event %s failed due to: %s", n, e)
106+ log.warning("Emission of upstart event %s failed due to: %s", n, e)
107
108 # vi: ts=4 expandtab
109diff --git a/cloudinit/config/cc_final_message.py b/cloudinit/config/cc_final_message.py
110index c61f03d..fd14154 100644
111--- a/cloudinit/config/cc_final_message.py
112+++ b/cloudinit/config/cc_final_message.py
113@@ -83,6 +83,6 @@ def handle(_name, cfg, cloud, log, args):
114 util.logexc(log, "Failed to write boot finished file %s", boot_fin_fn)
115
116 if cloud.datasource.is_disconnected:
117- log.warn("Used fallback datasource")
118+ log.warning("Used fallback datasource")
119
120 # vi: ts=4 expandtab
121diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
122index 564f376..aa9716e 100644
123--- a/cloudinit/config/cc_growpart.py
124+++ b/cloudinit/config/cc_growpart.py
125@@ -321,7 +321,7 @@ def handle(_name, cfg, _cloud, log, _args):
126
127 mycfg = cfg.get('growpart')
128 if not isinstance(mycfg, dict):
129- log.warn("'growpart' in config was not a dict")
130+ log.warning("'growpart' in config was not a dict")
131 return
132
133 mode = mycfg.get('mode', "auto")
134diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
135index aff4010..8f8735c 100644
136--- a/cloudinit/config/cc_keys_to_console.py
137+++ b/cloudinit/config/cc_keys_to_console.py
138@@ -52,8 +52,8 @@ def _get_helper_tool_path(distro):
139 def handle(name, cfg, cloud, log, _args):
140 helper_path = _get_helper_tool_path(cloud.distro)
141 if not os.path.exists(helper_path):
142- log.warn(("Unable to activate module %s,"
143- " helper tool not found at %s"), name, helper_path)
144+ log.warning(("Unable to activate module %s,"
145+ " helper tool not found at %s"), name, helper_path)
146 return
147
148 fp_blacklist = util.get_cfg_option_list(cfg,
149@@ -68,7 +68,7 @@ def handle(name, cfg, cloud, log, _args):
150 util.multi_log("%s\n" % (stdout.strip()),
151 stderr=False, console=True)
152 except Exception:
153- log.warn("Writing keys to the system console failed!")
154+ log.warning("Writing keys to the system console failed!")
155 raise
156
157 # vi: ts=4 expandtab
158diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py
159index d983077..151a984 100644
160--- a/cloudinit/config/cc_lxd.py
161+++ b/cloudinit/config/cc_lxd.py
162@@ -66,21 +66,21 @@ def handle(name, cfg, cloud, log, args):
163 name)
164 return
165 if not isinstance(lxd_cfg, dict):
166- log.warn("lxd config must be a dictionary. found a '%s'",
167- type(lxd_cfg))
168+ log.warning("lxd config must be a dictionary. found a '%s'",
169+ type(lxd_cfg))
170 return
171
172 # Grab the configuration
173 init_cfg = lxd_cfg.get('init')
174 if not isinstance(init_cfg, dict):
175- log.warn("lxd/init config must be a dictionary. found a '%s'",
176- type(init_cfg))
177+ log.warning("lxd/init config must be a dictionary. found a '%s'",
178+ type(init_cfg))
179 init_cfg = {}
180
181 bridge_cfg = lxd_cfg.get('bridge', {})
182 if not isinstance(bridge_cfg, dict):
183- log.warn("lxd/bridge config must be a dictionary. found a '%s'",
184- type(bridge_cfg))
185+ log.warning("lxd/bridge config must be a dictionary. found a '%s'",
186+ type(bridge_cfg))
187 bridge_cfg = {}
188
189 # Install the needed packages
190@@ -95,7 +95,7 @@ def handle(name, cfg, cloud, log, args):
191 try:
192 cloud.distro.install_packages(packages)
193 except util.ProcessExecutionError as exc:
194- log.warn("failed to install packages %s: %s", packages, exc)
195+ log.warning("failed to install packages %s: %s", packages, exc)
196 return
197
198 # Set up lxd if init config is given
199@@ -301,5 +301,4 @@ def maybe_cleanup_default(net_name, did_init, create, attach,
200 raise e
201 LOG.debug(msg, nic_name, profile, fail_assume_enoent)
202
203-
204 # vi: ts=4 expandtab
205diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
206index 123ffb8..c741c74 100644
207--- a/cloudinit/config/cc_mounts.py
208+++ b/cloudinit/config/cc_mounts.py
209@@ -251,10 +251,10 @@ def setup_swapfile(fname, size=None, maxsize=None):
210 util.ensure_dir(tdir)
211 util.log_time(LOG.debug, msg, func=util.subp,
212 args=[['sh', '-c',
213- ('rm -f "$1" && umask 0066 && '
214- '{ fallocate -l "${2}M" "$1" || '
215- ' dd if=/dev/zero "of=$1" bs=1M "count=$2"; } && '
216- 'mkswap "$1" || { r=$?; rm -f "$1"; exit $r; }'),
217+ ('rm -f "$1" && umask 0066 && '
218+ '{ fallocate -l "${2}M" "$1" || '
219+ 'dd if=/dev/zero "of=$1" bs=1M "count=$2"; } && '
220+ 'mkswap "$1" || { r=$?; rm -f "$1"; exit $r; }'),
221 'setup_swap', fname, mbsize]])
222
223 except Exception as e:
224@@ -347,8 +347,8 @@ def handle(_name, cfg, cloud, log, _args):
225 for i in range(len(cfgmnt)):
226 # skip something that wasn't a list
227 if not isinstance(cfgmnt[i], list):
228- log.warn("Mount option %s not a list, got a %s instead",
229- (i + 1), type_utils.obj_name(cfgmnt[i]))
230+ log.warning("Mount option %s not a list, got a %s instead",
231+ (i + 1), type_utils.obj_name(cfgmnt[i]))
232 continue
233
234 start = str(cfgmnt[i][0])
235@@ -495,7 +495,7 @@ def handle(_name, cfg, cloud, log, _args):
236 util.subp(cmd)
237 log.debug(fmt, "PASS")
238 except util.ProcessExecutionError:
239- log.warn(fmt, "FAIL")
240+ log.warning(fmt, "FAIL")
241 util.logexc(log, fmt, "FAIL")
242
243 # vi: ts=4 expandtab
244diff --git a/cloudinit/config/cc_package_update_upgrade_install.py b/cloudinit/config/cc_package_update_upgrade_install.py
245index 17b9101..86afffe 100644
246--- a/cloudinit/config/cc_package_update_upgrade_install.py
247+++ b/cloudinit/config/cc_package_update_upgrade_install.py
248@@ -108,7 +108,8 @@ def handle(_name, cfg, cloud, log, _args):
249 reboot_fn_exists = os.path.isfile(REBOOT_FILE)
250 if (upgrade or pkglist) and reboot_if_required and reboot_fn_exists:
251 try:
252- log.warn("Rebooting after upgrade or install per %s", REBOOT_FILE)
253+ log.warning("Rebooting after upgrade or install per "
254+ "%s", REBOOT_FILE)
255 # Flush the above warning + anything else out...
256 logging.flushLoggers(log)
257 _fire_reboot(log)
258@@ -117,8 +118,8 @@ def handle(_name, cfg, cloud, log, _args):
259 errors.append(e)
260
261 if len(errors):
262- log.warn("%s failed with exceptions, re-raising the last one",
263- len(errors))
264+ log.warning("%s failed with exceptions, re-raising the last one",
265+ len(errors))
266 raise errors[-1]
267
268 # vi: ts=4 expandtab
269diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py
270index 3be0d1c..b8e2709 100644
271--- a/cloudinit/config/cc_phone_home.py
272+++ b/cloudinit/config/cc_phone_home.py
273@@ -79,8 +79,8 @@ def handle(name, cfg, cloud, log, args):
274 ph_cfg = cfg['phone_home']
275
276 if 'url' not in ph_cfg:
277- log.warn(("Skipping module named %s, "
278- "no 'url' found in 'phone_home' configuration"), name)
279+ log.warning(("Skipping module named %s, "
280+ "no 'url' found in 'phone_home' configuration"), name)
281 return
282
283 url = ph_cfg['url']
284@@ -91,7 +91,7 @@ def handle(name, cfg, cloud, log, args):
285 except Exception:
286 tries = 10
287 util.logexc(log, "Configuration entry 'tries' is not an integer, "
288- "using %s instead", tries)
289+ "using %s instead", tries)
290
291 if post_list == "all":
292 post_list = POST_LIST_ALL
293@@ -112,7 +112,7 @@ def handle(name, cfg, cloud, log, args):
294 all_keys[n] = util.load_file(path)
295 except Exception:
296 util.logexc(log, "%s: failed to open, can not phone home that "
297- "data!", path)
298+ "data!", path)
299
300 submit_keys = {}
301 for k in post_list:
302@@ -120,8 +120,8 @@ def handle(name, cfg, cloud, log, args):
303 submit_keys[k] = all_keys[k]
304 else:
305 submit_keys[k] = None
306- log.warn(("Requested key %s from 'post'"
307- " configuration list not available"), k)
308+ log.warning(("Requested key %s from 'post'"
309+ " configuration list not available"), k)
310
311 # Get them read to be posted
312 real_submit_keys = {}
313diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py
314index 50b3747..43a479c 100644
315--- a/cloudinit/config/cc_power_state_change.py
316+++ b/cloudinit/config/cc_power_state_change.py
317@@ -103,24 +103,23 @@ def check_condition(cond, log=None):
318 return False
319 else:
320 if log:
321- log.warn(pre + "unexpected exit %s. " % ret +
322- "do not apply change.")
323+ log.warning(pre + "unexpected exit %s. " % ret +
324+ "do not apply change.")
325 return False
326 except Exception as e:
327 if log:
328- log.warn(pre + "Unexpected error: %s" % e)
329+ log.warning(pre + "Unexpected error: %s" % e)
330 return False
331
332
333 def handle(_name, cfg, _cloud, log, _args):
334-
335 try:
336 (args, timeout, condition) = load_power_state(cfg)
337 if args is None:
338 log.debug("no power_state provided. doing nothing")
339 return
340 except Exception as e:
341- log.warn("%s Not performing power state change!" % str(e))
342+ log.warning("%s Not performing power state change!" % str(e))
343 return
344
345 if condition is False:
346@@ -131,7 +130,7 @@ def handle(_name, cfg, _cloud, log, _args):
347
348 cmdline = givecmdline(mypid)
349 if not cmdline:
350- log.warn("power_state: failed to get cmdline of current process")
351+ log.warning("power_state: failed to get cmdline of current process")
352 return
353
354 devnull_fp = open(os.devnull, "w")
355@@ -214,7 +213,7 @@ def run_after_pid_gone(pid, pidcmdline, timeout, log, condition, func, args):
356
357 def fatal(msg):
358 if log:
359- log.warn(msg)
360+ log.warning(msg)
361 doexit(EXIT_FAIL)
362
363 known_errnos = (errno.ENOENT, errno.ESRCH)
364diff --git a/cloudinit/config/cc_puppet.py b/cloudinit/config/cc_puppet.py
365index 4190a20..e26712e 100644
366--- a/cloudinit/config/cc_puppet.py
367+++ b/cloudinit/config/cc_puppet.py
368@@ -98,8 +98,8 @@ def _autostart_puppet(log):
369 elif os.path.exists('/sbin/chkconfig'):
370 util.subp(['/sbin/chkconfig', 'puppet', 'on'], capture=False)
371 else:
372- log.warn(("Sorry we do not know how to enable"
373- " puppet services on this system"))
374+ log.warning(("Sorry we do not know how to enable"
375+ " puppet services on this system"))
376
377
378 def handle(name, cfg, cloud, log, _args):
379@@ -121,8 +121,8 @@ def handle(name, cfg, cloud, log, _args):
380
381 p_constants = PuppetConstants(conf_file, ssl_dir, log)
382 if not install and version:
383- log.warn(("Puppet install set false but version supplied,"
384- " doing nothing."))
385+ log.warning(("Puppet install set false but version supplied,"
386+ " doing nothing."))
387 elif install:
388 log.debug(("Attempting to install puppet %s,"),
389 version if version else 'latest')
390@@ -141,7 +141,7 @@ def handle(name, cfg, cloud, log, _args):
391 cleaned_lines = [i.lstrip() for i in contents.splitlines()]
392 cleaned_contents = '\n'.join(cleaned_lines)
393 # Move to puppet_config.read_file when dropping py2.7
394- puppet_config.readfp( # pylint: disable=W1505
395+ puppet_config.readfp( # pylint: disable=W1505
396 StringIO(cleaned_contents),
397 filename=p_constants.conf_path)
398 for (cfg_name, cfg) in puppet_cfg['conf'].items():
399diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
400index afd2e06..01dfc12 100644
401--- a/cloudinit/config/cc_resizefs.py
402+++ b/cloudinit/config/cc_resizefs.py
403@@ -8,7 +8,6 @@
404
405 """Resizefs: cloud-config module which resizes the filesystem"""
406
407-
408 import errno
409 import getopt
410 import os
411@@ -183,7 +182,7 @@ def maybe_get_writable_device_path(devpath, info, log):
412 not container):
413 devpath = util.rootdev_from_cmdline(util.get_cmdline())
414 if devpath is None:
415- log.warn("Unable to find device '/dev/root'")
416+ log.warning("Unable to find device '/dev/root'")
417 return None
418 log.debug("Converted /dev/root to '%s' per kernel cmdline", devpath)
419
420@@ -212,8 +211,8 @@ def maybe_get_writable_device_path(devpath, info, log):
421 log.debug("Device '%s' did not exist in container. "
422 "cannot resize: %s", devpath, info)
423 elif exc.errno == errno.ENOENT:
424- log.warn("Device '%s' did not exist. cannot resize: %s",
425- devpath, info)
426+ log.warning("Device '%s' did not exist. cannot resize: %s",
427+ devpath, info)
428 else:
429 raise exc
430 return None
431@@ -223,8 +222,8 @@ def maybe_get_writable_device_path(devpath, info, log):
432 log.debug("device '%s' not a block device in container."
433 " cannot resize: %s" % (devpath, info))
434 else:
435- log.warn("device '%s' not a block device. cannot resize: %s" %
436- (devpath, info))
437+ log.warning("device '%s' not a block device. cannot resize: %s" %
438+ (devpath, info))
439 return None
440 return devpath # The writable block devpath
441
442@@ -243,7 +242,7 @@ def handle(name, cfg, _cloud, log, args):
443 resize_what = "/"
444 result = util.get_mount_info(resize_what, log)
445 if not result:
446- log.warn("Could not determine filesystem type of %s", resize_what)
447+ log.warning("Could not determine filesystem type of %s", resize_what)
448 return
449
450 (devpth, fs_type, mount_point) = result
451@@ -280,8 +279,8 @@ def handle(name, cfg, _cloud, log, args):
452 break
453
454 if not resizer:
455- log.warn("Not resizing unknown filesystem type %s for %s",
456- fs_type, resize_what)
457+ log.warning("Not resizing unknown filesystem type %s for %s",
458+ fs_type, resize_what)
459 return
460
461 resize_cmd = resizer(resize_what, devpth)
462diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py
463index 9812562..69f4768 100644
464--- a/cloudinit/config/cc_resolv_conf.py
465+++ b/cloudinit/config/cc_resolv_conf.py
466@@ -102,11 +102,11 @@ def handle(name, cfg, cloud, log, _args):
467 return
468
469 if "resolv_conf" not in cfg:
470- log.warn("manage_resolv_conf True but no parameters provided!")
471+ log.warning("manage_resolv_conf True but no parameters provided!")
472
473 template_fn = cloud.get_template_filename('resolv.conf')
474 if not template_fn:
475- log.warn("No template found, not rendering /etc/resolv.conf")
476+ log.warning("No template found, not rendering /etc/resolv.conf")
477 return
478
479 generate_resolv_conf(template_fn=template_fn, params=cfg["resolv_conf"])
480diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
481index 4e34c7e..bd8ee89 100644
482--- a/cloudinit/config/cc_rightscale_userdata.py
483+++ b/cloudinit/config/cc_rightscale_userdata.py
484@@ -111,8 +111,8 @@ def handle(name, _cfg, cloud, log, _args):
485 log.debug("%s urls were skipped or failed", skipped)
486
487 if captured_excps:
488- log.warn("%s failed with exceptions, re-raising the last one",
489- len(captured_excps))
490+ log.warning("%s failed with exceptions, re-raising the last one",
491+ len(captured_excps))
492 raise captured_excps[-1]
493
494 # vi: ts=4 expandtab
495diff --git a/cloudinit/config/cc_rsyslog.py b/cloudinit/config/cc_rsyslog.py
496index 22b1753..ff211f6 100644
497--- a/cloudinit/config/cc_rsyslog.py
498+++ b/cloudinit/config/cc_rsyslog.py
499@@ -432,7 +432,7 @@ def handle(name, cfg, cloud, log, _args):
500 systemd=cloud.distro.uses_systemd()),
501 except util.ProcessExecutionError as e:
502 restarted = False
503- log.warn("Failed to reload syslog", e)
504+ log.warning("Failed to reload syslog", e)
505
506 if restarted:
507 # This only needs to run if we *actually* restarted
508diff --git a/cloudinit/config/cc_scripts_per_boot.py b/cloudinit/config/cc_scripts_per_boot.py
509index b03255c..588e1b0 100644
510--- a/cloudinit/config/cc_scripts_per_boot.py
511+++ b/cloudinit/config/cc_scripts_per_boot.py
512@@ -40,8 +40,8 @@ def handle(name, _cfg, cloud, log, _args):
513 try:
514 util.runparts(runparts_path)
515 except Exception:
516- log.warn("Failed to run module %s (%s in %s)",
517- name, SCRIPT_SUBDIR, runparts_path)
518+ log.warning("Failed to run module %s (%s in %s)",
519+ name, SCRIPT_SUBDIR, runparts_path)
520 raise
521
522 # vi: ts=4 expandtab
523diff --git a/cloudinit/config/cc_scripts_per_instance.py b/cloudinit/config/cc_scripts_per_instance.py
524index baee5cc..2bc8a6e 100644
525--- a/cloudinit/config/cc_scripts_per_instance.py
526+++ b/cloudinit/config/cc_scripts_per_instance.py
527@@ -40,8 +40,8 @@ def handle(name, _cfg, cloud, log, _args):
528 try:
529 util.runparts(runparts_path)
530 except Exception:
531- log.warn("Failed to run module %s (%s in %s)",
532- name, SCRIPT_SUBDIR, runparts_path)
533+ log.warning("Failed to run module %s (%s in %s)",
534+ name, SCRIPT_SUBDIR, runparts_path)
535 raise
536
537 # vi: ts=4 expandtab
538diff --git a/cloudinit/config/cc_scripts_per_once.py b/cloudinit/config/cc_scripts_per_once.py
539index 4943e9a..3f27ee3 100644
540--- a/cloudinit/config/cc_scripts_per_once.py
541+++ b/cloudinit/config/cc_scripts_per_once.py
542@@ -40,8 +40,8 @@ def handle(name, _cfg, cloud, log, _args):
543 try:
544 util.runparts(runparts_path)
545 except Exception:
546- log.warn("Failed to run module %s (%s in %s)",
547- name, SCRIPT_SUBDIR, runparts_path)
548+ log.warning("Failed to run module %s (%s in %s)",
549+ name, SCRIPT_SUBDIR, runparts_path)
550 raise
551
552 # vi: ts=4 expandtab
553diff --git a/cloudinit/config/cc_scripts_user.py b/cloudinit/config/cc_scripts_user.py
554index 6c66481..d940dbd 100644
555--- a/cloudinit/config/cc_scripts_user.py
556+++ b/cloudinit/config/cc_scripts_user.py
557@@ -44,8 +44,8 @@ def handle(name, _cfg, cloud, log, _args):
558 try:
559 util.runparts(runparts_path)
560 except Exception:
561- log.warn("Failed to run module %s (%s in %s)",
562- name, SCRIPT_SUBDIR, runparts_path)
563+ log.warning("Failed to run module %s (%s in %s)",
564+ name, SCRIPT_SUBDIR, runparts_path)
565 raise
566
567 # vi: ts=4 expandtab
568diff --git a/cloudinit/config/cc_scripts_vendor.py b/cloudinit/config/cc_scripts_vendor.py
569index 0292eaf..faac924 100644
570--- a/cloudinit/config/cc_scripts_vendor.py
571+++ b/cloudinit/config/cc_scripts_vendor.py
572@@ -48,8 +48,8 @@ def handle(name, cfg, cloud, log, _args):
573 try:
574 util.runparts(runparts_path, exe_prefix=prefix)
575 except Exception:
576- log.warn("Failed to run module %s (%s in %s)",
577- name, SCRIPT_SUBDIR, runparts_path)
578+ log.warning("Failed to run module %s (%s in %s)",
579+ name, SCRIPT_SUBDIR, runparts_path)
580 raise
581
582 # vi: ts=4 expandtab
583diff --git a/cloudinit/config/cc_seed_random.py b/cloudinit/config/cc_seed_random.py
584index 65f6e77..a5d7c73 100644
585--- a/cloudinit/config/cc_seed_random.py
586+++ b/cloudinit/config/cc_seed_random.py
587@@ -131,7 +131,7 @@ def handle(name, cfg, cloud, log, _args):
588 env['RANDOM_SEED_FILE'] = seed_path
589 handle_random_seed_command(command=command, required=req, env=env)
590 except ValueError as e:
591- log.warn("handling random command [%s] failed: %s", command, e)
592+ log.warning("handling random command [%s] failed: %s", command, e)
593 raise e
594
595 # vi: ts=4 expandtab
596diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
597index cf9b5ab..1379428 100755
598--- a/cloudinit/config/cc_set_passwords.py
599+++ b/cloudinit/config/cc_set_passwords.py
600@@ -164,7 +164,7 @@ def handle(_name, cfg, cloud, log, args):
601 if user:
602 plist = ["%s:%s" % (user, password)]
603 else:
604- log.warn("No default or defined user to change password for.")
605+ log.warning("No default or defined user to change password for.")
606
607 errors = []
608 if plist:
609diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py
610index c96eede..03fffb9 100644
611--- a/cloudinit/config/cc_update_etc_hosts.py
612+++ b/cloudinit/config/cc_update_etc_hosts.py
613@@ -62,8 +62,8 @@ def handle(name, cfg, cloud, log, _args):
614 if util.translate_bool(manage_hosts, addons=['template']):
615 (hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
616 if not hostname:
617- log.warn(("Option 'manage_etc_hosts' was set,"
618- " but no hostname was found"))
619+ log.warning(("Option 'manage_etc_hosts' was set,"
620+ " but no hostname was found"))
621 return
622
623 # Render from a template file
624@@ -80,8 +80,8 @@ def handle(name, cfg, cloud, log, _args):
625 elif manage_hosts == "localhost":
626 (hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
627 if not hostname:
628- log.warn(("Option 'manage_etc_hosts' was set,"
629- " but no hostname was found"))
630+ log.warning(("Option 'manage_etc_hosts' was set,"
631+ " but no hostname was found"))
632 return
633
634 log.debug("Managing localhost in /etc/hosts")
635diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
636index 6a42f49..3b354a7 100644
637--- a/cloudinit/config/cc_yum_add_repo.py
638+++ b/cloudinit/config/cc_yum_add_repo.py
639@@ -113,16 +113,16 @@ def handle(name, cfg, _cloud, log, _args):
640 missing_required = 0
641 for req_field in ['baseurl']:
642 if req_field not in repo_config:
643- log.warn(("Repository %s does not contain a %s"
644- " configuration 'required' entry"),
645- repo_id, req_field)
646+ log.warning(("Repository %s does not contain a %s"
647+ " configuration 'required' entry"),
648+ repo_id, req_field)
649 missing_required += 1
650 if not missing_required:
651 repo_configs[canon_repo_id] = repo_config
652 repo_locations[canon_repo_id] = repo_fn_pth
653 else:
654- log.warn("Repository %s is missing %s required fields, skipping!",
655- repo_id, missing_required)
656+ log.warning("Repository %s is missing %s required fields, "
657+ "skipping!", repo_id, missing_required)
658 for (c_repo_id, path) in repo_locations.items():
659 repo_blob = _format_repository_config(c_repo_id,
660 repo_configs.get(c_repo_id))
661diff --git a/tests/unittests/test_handler/test_handler_power_state.py b/tests/unittests/test_handler/test_handler_power_state.py
662index 3c72642..0d8d17b 100644
663--- a/tests/unittests/test_handler/test_handler_power_state.py
664+++ b/tests/unittests/test_handler/test_handler_power_state.py
665@@ -90,7 +90,7 @@ class TestCheckCondition(t_help.TestCase):
666 mocklog = mock.Mock()
667 self.assertEqual(
668 psc.check_condition(self.cmd_with_exit(2), mocklog), False)
669- self.assertEqual(mocklog.warn.call_count, 1)
670+ self.assertEqual(mocklog.warning.call_count, 1)
671
672
673 def check_lps_ret(psc_return, mode=None):

Subscribers

People subscribed via source and target branches