summaryrefslogtreecommitdiff
path: root/cloudinit/distros/arch.py
diff options
context:
space:
mode:
authorParide Legovini <paride.legovini@canonical.com>2021-07-20 16:58:21 +0200
committerGitHub <noreply@github.com>2021-07-20 09:58:21 -0500
commitec6afadbf0f0f77d5b58dccd70df77da89c2c91d (patch)
tree5f1a719faf924b28cdc2d6958a3b6a8eb2c771bf /cloudinit/distros/arch.py
parenta984ee78b745b157b4b023a1786bfbd3b2002b88 (diff)
downloadvyos-cloud-init-ec6afadbf0f0f77d5b58dccd70df77da89c2c91d.tar.gz
vyos-cloud-init-ec6afadbf0f0f77d5b58dccd70df77da89c2c91d.zip
Update pylint to v2.9.3 and fix the new issues it spots (#946)
In CI run against pylint 2.9.3 and fix occurrences of: - W0237 (arguments-renamed) - W0402 (deprecated-module) The W0402 deprecated-module was about module `imp`: cloudinit/patcher.py:9: [W0402(deprecated-module), ] Uses of a deprecated module 'imp' The imp module is deprecated and replaced by importlib, which according to the documentation has no replacement for acquire_lock() and release_lock(), which are the only reason why `imp` is imported. Nothing about the code using this lock that actually requires it. Let's remove the locking code and the import altogether. Dropping the locking makes patcher.patch() an empty wrapper around _patch_logging(). Rename _patch_logging() to patch_logging() and call it directly instead. Drop patch().
Diffstat (limited to 'cloudinit/distros/arch.py')
-rw-r--r--cloudinit/distros/arch.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py
index c9acb11f..3c5bbb38 100644
--- a/cloudinit/distros/arch.py
+++ b/cloudinit/distros/arch.py
@@ -101,18 +101,18 @@ class Distro(distros.Distro):
util.logexc(LOG, "Running interface command %s failed", cmd)
return False
- def _write_hostname(self, your_hostname, out_fn):
+ def _write_hostname(self, hostname, filename):
conf = None
try:
# Try to update the previous one
# so lets see if we can read it first.
- conf = self._read_hostname_conf(out_fn)
+ conf = self._read_hostname_conf(filename)
except IOError:
pass
if not conf:
conf = HostnameConf('')
- conf.set_hostname(your_hostname)
- util.write_file(out_fn, str(conf), omode="w", mode=0o644)
+ conf.set_hostname(hostname)
+ util.write_file(filename, str(conf), omode="w", mode=0o644)
def _read_system_hostname(self):
sys_hostname = self._read_hostname(self.hostname_conf_fn)