Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pylint and fix the new issues its spots #946

Merged
merged 5 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cloudinit/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def uses_systemd(self):
return uses_systemd()

@abc.abstractmethod
def package_command(self, cmd, args=None, pkgs=None):
def package_command(self, command, args=None, pkgs=None):
raise NotImplementedError()

@abc.abstractmethod
Expand Down Expand Up @@ -253,7 +253,7 @@ def _read_hostname(self, filename, default=None):
raise NotImplementedError()

@abc.abstractmethod
def _write_hostname(self, hostname, filename):
def _write_hostname(self, hostname, out_fn):
paride marked this conversation as resolved.
Show resolved Hide resolved
raise NotImplementedError()

@abc.abstractmethod
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/distros/alpine.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def install_packages(self, pkglist):
self.update_package_sources()
self.package_command('add', pkgs=pkglist)

def _write_hostname(self, your_hostname, out_fn):
def _write_hostname(self, hostname, out_fn):
conf = None
try:
# Try to update the previous one
Expand All @@ -83,7 +83,7 @@ def _write_hostname(self, your_hostname, out_fn):
pass
if not conf:
conf = HostnameConf('')
conf.set_hostname(your_hostname)
conf.set_hostname(hostname)
util.write_file(out_fn, str(conf), 0o644)

def _read_system_hostname(self):
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/distros/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _bring_up_interface(self, device_name):
util.logexc(LOG, "Running interface command %s failed", cmd)
return False

def _write_hostname(self, your_hostname, out_fn):
def _write_hostname(self, hostname, out_fn):
conf = None
try:
# Try to update the previous one
Expand All @@ -111,7 +111,7 @@ def _write_hostname(self, your_hostname, out_fn):
pass
if not conf:
conf = HostnameConf('')
conf.set_hostname(your_hostname)
conf.set_hostname(hostname)
util.write_file(out_fn, str(conf), omode="w", mode=0o644)

def _read_system_hostname(self):
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/distros/bsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _read_hostname(self, filename, default=None):
def _get_add_member_to_group_cmd(self, member_name, group_name):
raise NotImplementedError('Return list cmd to add member to group')

def _write_hostname(self, hostname, filename):
def _write_hostname(self, hostname, out_fn):
bsd_utils.set_rc_config_value('hostname', hostname, fn='/etc/rc.conf')

def create_group(self, name, members=None):
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/distros/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _write_network_state(self, network_state):
_maybe_remove_legacy_eth0()
return super()._write_network_state(network_state)

def _write_hostname(self, your_hostname, out_fn):
def _write_hostname(self, hostname, out_fn):
conf = None
try:
# Try to update the previous one
Expand All @@ -125,7 +125,7 @@ def _write_hostname(self, your_hostname, out_fn):
pass
if not conf:
conf = HostnameConf('')
conf.set_hostname(your_hostname)
conf.set_hostname(hostname)
util.write_file(out_fn, str(conf), 0o644)

def _read_system_hostname(self):
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/distros/gentoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _bring_up_interfaces(self, device_names):
else:
return distros.Distro._bring_up_interfaces(self, device_names)

def _write_hostname(self, your_hostname, out_fn):
def _write_hostname(self, hostname, out_fn):
conf = None
try:
# Try to update the previous one
Expand All @@ -163,7 +163,7 @@ def _write_hostname(self, your_hostname, out_fn):
# Many distro's format is the hostname by itself, and that is the
# way HostnameConf works but gentoo expects it to be in
# hostname="the-actual-hostname"
conf.set_hostname('hostname="%s"' % your_hostname)
conf.set_hostname('hostname="%s"' % hostname)
util.write_file(out_fn, str(conf), 0o644)

def _read_system_hostname(self):
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/distros/openbsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Distro(cloudinit.distros.netbsd.NetBSD):
def _read_hostname(self, filename, default=None):
return util.load_file(self.hostname_conf_fn)

def _write_hostname(self, hostname, filename):
def _write_hostname(self, hostname, out_fn):
content = hostname + '\n'
util.write_file(self.hostname_conf_fn, content)

Expand Down
7 changes: 1 addition & 6 deletions cloudinit/patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#
# This file is part of cloud-init. See LICENSE file for license information.

import imp
import logging
import sys

Expand Down Expand Up @@ -39,10 +38,6 @@ def handleError(self, record):


def patch():
imp.acquire_lock()
try:
_patch_logging()
finally:
imp.release_lock()
_patch_logging()
paride marked this conversation as resolved.
Show resolved Hide resolved

# vi: ts=4 expandtab
4 changes: 2 additions & 2 deletions tests/unittests/test_distros/test_create_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def install_packages(self, pkglist):
def _write_network(self, settings):
raise NotImplementedError()

def package_command(self, cmd, args=None, pkgs=None):
def package_command(self, command, args=None, pkgs=None):
raise NotImplementedError()

def update_package_sources(self):
Expand All @@ -38,7 +38,7 @@ def set_timezone(self, tz):
def _read_hostname(self, filename, default=None):
raise NotImplementedError()

def _write_hostname(self, hostname, filename):
def _write_hostname(self, hostname, out_fn):
raise NotImplementedError()

def _read_system_hostname(self):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setenv =
basepython = python3
deps =
# requirements
pylint==2.6.0
pylint==2.9.3
# test-requirements because unit tests are now present in cloudinit tree
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
Expand Down