diff options
author | Joshua Powers <josh.powers@canonical.com> | 2017-04-06 11:14:29 -0700 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2017-04-21 10:14:47 -0400 |
commit | 5afe4cd0797a12d07ea19b9715b720d47bdea401 (patch) | |
tree | 8be9e7b623002b1fd60fb21b95696ab6b67ca497 /cloudinit/util.py | |
parent | 33816e96d8981918f734dab3ee1a967bce85451a (diff) | |
download | vyos-cloud-init-5afe4cd0797a12d07ea19b9715b720d47bdea401.tar.gz vyos-cloud-init-5afe4cd0797a12d07ea19b9715b720d47bdea401.zip |
pylint: fix all logging warnings
This will change all instances of LOG.warn to LOG.warning as warn
is now a deprecated method. It will also make sure any logging
uses lazy logging by passing string format arguments as function
parameters.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 6940850c..bfddca67 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -96,11 +96,11 @@ def _lsb_release(target=None): data[fmap[fname]] = val.strip() missing = [k for k in fmap.values() if k not in data] if len(missing): - LOG.warn("Missing fields in lsb_release --all output: %s", - ','.join(missing)) + LOG.warning("Missing fields in lsb_release --all output: %s", + ','.join(missing)) except ProcessExecutionError as err: - LOG.warn("Unable to get lsb_release --all: %s", err) + LOG.warning("Unable to get lsb_release --all: %s", err) data = dict((v, "UNAVAILABLE") for v in fmap.values()) return data @@ -590,7 +590,7 @@ def system_info(): 'release': platform.release(), 'python': platform.python_version(), 'uname': platform.uname(), - 'dist': platform.linux_distribution(), + 'dist': platform.linux_distribution(), # pylint: disable=W1505 } @@ -865,7 +865,7 @@ def read_file_or_url(url, timeout=5, retries=10, url = "file://%s" % url if url.lower().startswith("file://"): if data: - LOG.warn("Unable to post data to file resource %s", url) + LOG.warning("Unable to post data to file resource %s", url) file_path = url[len("file://"):] try: contents = load_file(file_path, decode=False) @@ -1279,7 +1279,7 @@ def get_cmdline(): # replace nulls with space and drop trailing null cmdline = contents.replace("\x00", " ")[:-1] except Exception as e: - LOG.warn("failed reading /proc/1/cmdline: %s", e) + LOG.warning("failed reading /proc/1/cmdline: %s", e) cmdline = "" else: try: @@ -1400,7 +1400,7 @@ def logexc(log, msg, *args): # or even desirable to have that much junk # coming out to a non-debug stream if msg: - log.warn(msg, *args) + log.warning(msg, *args) # Debug gets the full trace. However, nose has a bug whereby its # logcapture plugin doesn't properly handle the case where there is no # actual exception. To avoid tracebacks during the test suite then, we'll @@ -2344,8 +2344,8 @@ def read_dmi_data(key): if dmidecode_path: return _call_dmidecode(key, dmidecode_path) - LOG.warn("did not find either path %s or dmidecode command", - DMI_SYS_PATH) + LOG.warning("did not find either path %s or dmidecode command", + DMI_SYS_PATH) return None |