From 1c5149c3dea5b8d3d2e34cc931c8036830f817ef Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 16 Feb 2021 08:58:51 +0100 Subject: [PATCH] Tidy up all pylint:blacklisted-name ignore lines (#1819) (#1840) * fixed validation-modules for plugins/callback/hipchat.py * fixed validation-modules for plugins/connection/lxc.py * fixed validation-modules for plugins/modules/cloud/lxc/lxc_container.py * fixed validation-modules for plugins/modules/monitoring/statusio_maintenance.py * fixed validation-modules for plugins/modules/system/alternatives.py * fixed validation-modules for plugins/modules/system/beadm.py * fixed validation-modules for plugins/modules/system/cronvar.py * fixed validation-modules for plugins/modules/system/dconf.py * fixed validation-modules for plugins/modules/system/interfaces_file.py * fixed validation-modules for plugins/modules/system/java_cert.py * fixed validation-modules for plugins/modules/system/lvg.py * fixed validation-modules for plugins/modules/system/lvol.py * fixed validation-modules for plugins/modules/system/parted.py * fixed validation-modules for plugins/modules/system/timezone.py * fixed validation-modules for plugins/modules/web_infrastructure/rundeck_acl_policy.py * Tidy up all pylint:blacklisted-name sanity checks ignore lines * Missed one in statusio_maintenace.py * fixed validation-modules for plugins/modules/system/filesystem.py * Missed one in gconftool2.py * Missed one in alternatives.py * Using dummies now * fixed indentation * Made all the changes about replacing _ with dummy * Rollback bug fixed * Rollback bug fixed, part II * added changelog fragment * Improved changelog frag message per PR (cherry picked from commit 03b7b39424d639821a7994e66459ee25e94365e8) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- .../1819-tidyup-pylint-blacklistnames.yml | 17 ++++++++++++++++ plugins/callback/hipchat.py | 3 +-- plugins/connection/lxc.py | 2 +- plugins/modules/cloud/lxc/lxc_container.py | 6 +++--- .../monitoring/statusio_maintenance.py | 4 ++-- plugins/modules/system/alternatives.py | 4 ++-- plugins/modules/system/beadm.py | 6 +++--- plugins/modules/system/cronvar.py | 8 ++++---- plugins/modules/system/dconf.py | 4 ++-- plugins/modules/system/filesystem.py | 20 +++++++++---------- plugins/modules/system/gconftool2.py | 2 +- plugins/modules/system/interfaces_file.py | 2 +- plugins/modules/system/java_cert.py | 4 ++-- plugins/modules/system/lvg.py | 14 ++++++------- plugins/modules/system/lvol.py | 8 ++++---- plugins/modules/system/parted.py | 2 +- plugins/modules/system/timezone.py | 4 ++-- .../web_infrastructure/rundeck_acl_policy.py | 12 +++++------ tests/sanity/ignore-2.10.txt | 17 ---------------- tests/sanity/ignore-2.11.txt | 17 ---------------- tests/sanity/ignore-2.9.txt | 17 ---------------- 21 files changed, 69 insertions(+), 104 deletions(-) create mode 100644 changelogs/fragments/1819-tidyup-pylint-blacklistnames.yml diff --git a/changelogs/fragments/1819-tidyup-pylint-blacklistnames.yml b/changelogs/fragments/1819-tidyup-pylint-blacklistnames.yml new file mode 100644 index 0000000000..fdbc850528 --- /dev/null +++ b/changelogs/fragments/1819-tidyup-pylint-blacklistnames.yml @@ -0,0 +1,17 @@ +bugfixes: + - "alternatives - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "beadm - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "cronvar - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "dconf - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "filesystem - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "hipchat - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "interfaces_file - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "java_cert - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "lvg - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "lvol - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "lxc - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "lxc_container - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "parted - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "rundeck_acl_policy - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "statusio_maintenance - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." + - "timezone - internal refactoring: replaced uses of ``_`` with ``dummy`` (https://github.com/ansible-collections/community.general/pull/1819)." diff --git a/plugins/callback/hipchat.py b/plugins/callback/hipchat.py index efe4e94e88..0446ce824c 100644 --- a/plugins/callback/hipchat.py +++ b/plugins/callback/hipchat.py @@ -173,8 +173,7 @@ class CallbackModule(CallbackBase): # Displays info about playbook being started by a person on an # inventory, as well as Tags, Skip Tags and Limits if not self.printed_playbook: - self.playbook_name, _ = os.path.splitext( - os.path.basename(self.play.playbook.filename)) + self.playbook_name, dummy = os.path.splitext(os.path.basename(self.play.playbook.filename)) host_list = self.play.playbook.inventory.host_list inventory = os.path.basename(os.path.realpath(host_list)) self.send_msg("%s: Playbook initiated by %s against %s" % diff --git a/plugins/connection/lxc.py b/plugins/connection/lxc.py index b3b68a5164..faa8990bbc 100644 --- a/plugins/connection/lxc.py +++ b/plugins/connection/lxc.py @@ -86,7 +86,7 @@ class Connection(ConnectionBase): write_fds = [] while len(read_fds) > 0 or len(write_fds) > 0: try: - ready_reads, ready_writes, _ = select.select(read_fds, write_fds, []) + ready_reads, ready_writes, dummy = select.select(read_fds, write_fds, []) except select.error as e: if e.args[0] == errno.EINTR: continue diff --git a/plugins/modules/cloud/lxc/lxc_container.py b/plugins/modules/cloud/lxc/lxc_container.py index c1a3d1c424..2b5efe9cd7 100644 --- a/plugins/modules/cloud/lxc/lxc_container.py +++ b/plugins/modules/cloud/lxc/lxc_container.py @@ -730,7 +730,7 @@ class LxcContainerManagement(object): for option_line in container_config: # Look for key in config if keyre.match(option_line): - _, _value = option_line.split('=', 1) + dummy, _value = option_line.split('=', 1) config_value = ' '.join(_value.split()) line_index = container_config.index(option_line) # If the sanitized values don't match replace them @@ -953,7 +953,7 @@ class LxcContainerManagement(object): """ self.container = self.get_container_bind() - for _ in xrange(timeout): + for dummy in xrange(timeout): if self._get_state() != 'running': self.container.start() self.state_change = True @@ -1006,7 +1006,7 @@ class LxcContainerManagement(object): :type timeout: ``int`` """ - for _ in xrange(timeout): + for dummy in xrange(timeout): if not self._container_exists(container_name=self.container_name, lxc_path=self.lxc_path): break diff --git a/plugins/modules/monitoring/statusio_maintenance.py b/plugins/modules/monitoring/statusio_maintenance.py index 01411cf17f..3a6124f8b0 100644 --- a/plugins/modules/monitoring/statusio_maintenance.py +++ b/plugins/modules/monitoring/statusio_maintenance.py @@ -425,7 +425,7 @@ def main(): if module.check_mode: module.exit_json(changed=True) else: - (rc, _, error) = create_maintenance( + (rc, dummy, error) = create_maintenance( auth_headers, url, statuspage, host_ids, all_infrastructure_affected, automation, title, desc, returned_date, maintenance_notify_now, @@ -451,7 +451,7 @@ def main(): if module.check_mode: module.exit_json(changed=True) else: - (rc, _, error) = delete_maintenance( + (rc, dummy, error) = delete_maintenance( auth_headers, url, statuspage, maintenance_id) if rc == 0: module.exit_json( diff --git a/plugins/modules/system/alternatives.py b/plugins/modules/system/alternatives.py index 56db6dc69c..5831382680 100644 --- a/plugins/modules/system/alternatives.py +++ b/plugins/modules/system/alternatives.py @@ -94,7 +94,7 @@ def main(): all_alternatives = [] # Run `update-alternatives --display ` to find existing alternatives - (rc, display_output, _) = module.run_command( + (rc, display_output, dummy) = module.run_command( ['env', 'LC_ALL=C', UPDATE_ALTERNATIVES, '--display', name] ) @@ -117,7 +117,7 @@ def main(): # # This is only compatible on Debian-based systems, as the other # alternatives don't have --query available - rc, query_output, _ = module.run_command( + rc, query_output, dummy = module.run_command( ['env', 'LC_ALL=C', UPDATE_ALTERNATIVES, '--query', name] ) if rc == 0: diff --git a/plugins/modules/system/beadm.py b/plugins/modules/system/beadm.py index ab53d0661a..d34c5e7d96 100644 --- a/plugins/modules/system/beadm.py +++ b/plugins/modules/system/beadm.py @@ -191,7 +191,7 @@ class BE(object): return None def exists(self): - (rc, out, _) = self._beadm_list() + (rc, out, dummy) = self._beadm_list() if rc == 0: if self._find_be_by_name(out): @@ -202,7 +202,7 @@ class BE(object): return False def is_activated(self): - (rc, out, _) = self._beadm_list() + (rc, out, dummy) = self._beadm_list() if rc == 0: line = self._find_be_by_name(out) @@ -257,7 +257,7 @@ class BE(object): return self.module.run_command(cmd) def is_mounted(self): - (rc, out, _) = self._beadm_list() + (rc, out, dummy) = self._beadm_list() if rc == 0: line = self._find_be_by_name(out) diff --git a/plugins/modules/system/cronvar.py b/plugins/modules/system/cronvar.py index a76f6a7891..9871668ac0 100644 --- a/plugins/modules/system/cronvar.py +++ b/plugins/modules/system/cronvar.py @@ -228,7 +228,7 @@ class CronVar(object): var_names = [] for l in self.lines: try: - (var_name, _) = self.parse_for_var(l) + var_name, dummy = self.parse_for_var(l) var_names.append(var_name) except CronVarError: pass @@ -242,7 +242,7 @@ class CronVar(object): newlines = [] for l in self.lines: try: - (varname, _) = self.parse_for_var(l) # Throws if not a var line + varname, dummy = self.parse_for_var(l) # Throws if not a var line if varname == insertbefore: newlines.append("%s=%s" % (name, value)) newlines.append(l) @@ -263,7 +263,7 @@ class CronVar(object): newlines = [] for l in self.lines: try: - (varname, _) = self.parse_for_var(l) # Throws if not a var line + varname, dummy = self.parse_for_var(l) # Throws if not a var line if varname != name: raise CronVarError # Append. if not remove: @@ -377,7 +377,7 @@ def main(): # if requested make a backup before making a change if backup: - (_, backup_file) = tempfile.mkstemp(prefix='cronvar') + dummy, backup_file = tempfile.mkstemp(prefix='cronvar') cronvar.write(backup_file) if cronvar.cron_file and not name and not ensure_present: diff --git a/plugins/modules/system/dconf.py b/plugins/modules/system/dconf.py index 49c424323d..d92d45ed89 100644 --- a/plugins/modules/system/dconf.py +++ b/plugins/modules/system/dconf.py @@ -184,13 +184,13 @@ class DBusWrapper(object): for pid in psutil.pids(): process = psutil.Process(pid) - process_real_uid, _, _ = process.uids() + process_real_uid, dummy, dummy = process.uids() try: if process_real_uid == uid and 'DBUS_SESSION_BUS_ADDRESS' in process.environ(): dbus_session_bus_address_candidate = process.environ()['DBUS_SESSION_BUS_ADDRESS'] self.module.debug("Found D-Bus user session candidate at address: %s" % dbus_session_bus_address_candidate) command = ['dbus-send', '--address=%s' % dbus_session_bus_address_candidate, '--type=signal', '/', 'com.example.test'] - rc, _, _ = self.module.run_command(command) + rc, dummy, dummy = self.module.run_command(command) if rc == 0: self.module.debug("Verified D-Bus user session candidate as usable at address: %s" % dbus_session_bus_address_candidate) diff --git a/plugins/modules/system/filesystem.py b/plugins/modules/system/filesystem.py index 48c68a35ad..6944178da1 100644 --- a/plugins/modules/system/filesystem.py +++ b/plugins/modules/system/filesystem.py @@ -114,7 +114,7 @@ class Device(object): statinfo = os.stat(self.path) if stat.S_ISBLK(statinfo.st_mode): blockdev_cmd = self.module.get_bin_path("blockdev", required=True) - _, devsize_in_bytes, _ = self.module.run_command([blockdev_cmd, "--getsize64", self.path], check_rc=True) + dummy, devsize_in_bytes, dummy = self.module.run_command([blockdev_cmd, "--getsize64", self.path], check_rc=True) return int(devsize_in_bytes) elif os.path.isfile(self.path): return os.path.getsize(self.path) @@ -126,8 +126,8 @@ class Device(object): cmd_findmnt = self.module.get_bin_path("findmnt", required=True) # find mountpoint - rc, mountpoint, _ = self.module.run_command([cmd_findmnt, "--mtab", "--noheadings", "--output", - "TARGET", "--source", self.path], check_rc=False) + rc, mountpoint, dummy = self.module.run_command([cmd_findmnt, "--mtab", "--noheadings", "--output", + "TARGET", "--source", self.path], check_rc=False) if rc != 0: mountpoint = None else: @@ -203,7 +203,7 @@ class Filesystem(object): elif self.module.check_mode: self.module.exit_json(changed=True, msg="Resizing filesystem %s on device %s" % (self.fstype, dev)) else: - _, out, _ = self.module.run_command(self.grow_cmd(dev), check_rc=True) + dummy, out, dummy = self.module.run_command(self.grow_cmd(dev), check_rc=True) return out @@ -214,7 +214,7 @@ class Ext(Filesystem): def get_fs_size(self, dev): cmd = self.module.get_bin_path('tune2fs', required=True) # Get Block count and Block size - _, size, _ = self.module.run_command([cmd, '-l', str(dev)], check_rc=True, environ_update=self.LANG_ENV) + dummy, size, dummy = self.module.run_command([cmd, '-l', str(dev)], check_rc=True, environ_update=self.LANG_ENV) for line in size.splitlines(): if 'Block count:' in line: block_count = int(line.split(':')[1].strip()) @@ -290,7 +290,7 @@ class Btrfs(Filesystem): def __init__(self, module): super(Btrfs, self).__init__(module) - _, stdout, stderr = self.module.run_command('%s --version' % self.MKFS, check_rc=True) + dummy, stdout, stderr = self.module.run_command('%s --version' % self.MKFS, check_rc=True) match = re.search(r" v([0-9.]+)", stdout) if not match: # v0.20-rc1 use stderr @@ -320,7 +320,7 @@ class F2fs(Filesystem): def MKFS_FORCE_FLAGS(self): mkfs = self.module.get_bin_path(self.MKFS, required=True) cmd = "%s %s" % (mkfs, os.devnull) - _, out, _ = self.module.run_command(cmd, check_rc=False, environ_update=self.LANG_ENV) + dummy, out, dummy = self.module.run_command(cmd, check_rc=False, environ_update=self.LANG_ENV) # Looking for " F2FS-tools: mkfs.f2fs Ver: 1.10.0 (2018-01-30)" # mkfs.f2fs displays version since v1.2.0 match = re.search(r"F2FS-tools: mkfs.f2fs Ver: ([0-9.]+) \(", out) @@ -335,7 +335,7 @@ class F2fs(Filesystem): def get_fs_size(self, dev): cmd = self.module.get_bin_path('dump.f2fs', required=True) # Get sector count and sector size - _, dump, _ = self.module.run_command([cmd, str(dev)], check_rc=True, environ_update=self.LANG_ENV) + dummy, dump, dummy = self.module.run_command([cmd, str(dev)], check_rc=True, environ_update=self.LANG_ENV) sector_size = None sector_count = None for line in dump.splitlines(): @@ -364,7 +364,7 @@ class VFAT(Filesystem): def get_fs_size(self, dev): cmd = self.module.get_bin_path(self.GROW, required=True) - _, output, _ = self.module.run_command([cmd, '--info', str(dev)], check_rc=True, environ_update=self.LANG_ENV) + dummy, output, dummy = self.module.run_command([cmd, '--info', str(dev)], check_rc=True, environ_update=self.LANG_ENV) for line in output.splitlines()[1:]: param, value = line.split(':', 1) if param.strip() == 'Size': @@ -383,7 +383,7 @@ class LVM(Filesystem): def get_fs_size(self, dev): cmd = self.module.get_bin_path('pvs', required=True) - _, size, _ = self.module.run_command([cmd, '--noheadings', '-o', 'pv_size', '--units', 'b', '--nosuffix', str(dev)], check_rc=True) + dummy, size, dummy = self.module.run_command([cmd, '--noheadings', '-o', 'pv_size', '--units', 'b', '--nosuffix', str(dev)], check_rc=True) block_count = int(size) return block_count diff --git a/plugins/modules/system/gconftool2.py b/plugins/modules/system/gconftool2.py index b1df1da85a..a4acad5580 100644 --- a/plugins/modules/system/gconftool2.py +++ b/plugins/modules/system/gconftool2.py @@ -200,7 +200,7 @@ def main(): gconf_pref = GConf2Preference(module, key, value_type, value, direct, config_source) # Now we get the current value, if not found don't fail - _, current_value = gconf_pref.call("get", fail_onerr=False) + dummy, current_value = gconf_pref.call("get", fail_onerr=False) # Check if the current value equals the value we want to set. If not, make # a change diff --git a/plugins/modules/system/interfaces_file.py b/plugins/modules/system/interfaces_file.py index d1e3757304..618a472d91 100644 --- a/plugins/modules/system/interfaces_file.py +++ b/plugins/modules/system/interfaces_file.py @@ -385,7 +385,7 @@ def main(): changed, lines = setInterfaceOption(module, lines, iface, option, value, state, address_family) if changed: - _, ifaces = read_interfaces_lines(module, [d['line'] for d in lines if 'line' in d]) + dummy, ifaces = read_interfaces_lines(module, [d['line'] for d in lines if 'line' in d]) if changed and not module.check_mode: if backup: diff --git a/plugins/modules/system/java_cert.py b/plugins/modules/system/java_cert.py index 7333397bfd..6594ed235b 100644 --- a/plugins/modules/system/java_cert.py +++ b/plugins/modules/system/java_cert.py @@ -185,7 +185,7 @@ def check_cert_present(module, executable, keystore_path, keystore_pass, alias, test_cmd = ("%s -noprompt -list -keystore '%s' -storepass '%s' " "-alias '%s' %s") % (executable, keystore_path, keystore_pass, alias, get_keystore_type(keystore_type)) - (check_rc, _, _) = module.run_command(test_cmd) + check_rc, dummy, dummy = module.run_command(test_cmd) if check_rc == 0: return True return False @@ -221,7 +221,7 @@ def import_cert_url(module, executable, url, port, keystore_path, keystore_pass, import_cmd = import_cmd + " -trustcacerts" # Fetch SSL certificate from remote host. - (_, fetch_out, _) = module.run_command(fetch_cmd, check_rc=True) + dummy, fetch_out, dummy = module.run_command(fetch_cmd, check_rc=True) # Use remote certificate from remote host and import it to a java keystore (import_rc, import_out, import_err) = module.run_command(import_cmd, diff --git a/plugins/modules/system/lvg.py b/plugins/modules/system/lvg.py index 25f261aef8..47d3d6c230 100644 --- a/plugins/modules/system/lvg.py +++ b/plugins/modules/system/lvg.py @@ -232,13 +232,13 @@ def main(): # create PV pvcreate_cmd = module.get_bin_path('pvcreate', True) for current_dev in dev_list: - rc, _, err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)]) + rc, dummy, err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)]) if rc == 0: changed = True else: module.fail_json(msg="Creating physical volume '%s' failed" % current_dev, rc=rc, err=err) vgcreate_cmd = module.get_bin_path('vgcreate') - rc, _, err = module.run_command([vgcreate_cmd] + vgoptions + ['-s', pesize, vg] + dev_list) + rc, dummy, err = module.run_command([vgcreate_cmd] + vgoptions + ['-s', pesize, vg] + dev_list) if rc == 0: changed = True else: @@ -251,7 +251,7 @@ def main(): if this_vg['lv_count'] == 0 or force: # remove VG vgremove_cmd = module.get_bin_path('vgremove', True) - rc, _, err = module.run_command("%s --force %s" % (vgremove_cmd, vg)) + rc, dummy, err = module.run_command("%s --force %s" % (vgremove_cmd, vg)) if rc == 0: module.exit_json(changed=True) else: @@ -283,7 +283,7 @@ def main(): if module.check_mode: changed = True else: - rc, _, err = module.run_command([pvresize_cmd, device]) + rc, dummy, err = module.run_command([pvresize_cmd, device]) if rc != 0: module.fail_json(msg="Failed executing pvresize command.", rc=rc, err=err) else: @@ -298,14 +298,14 @@ def main(): # create PV pvcreate_cmd = module.get_bin_path('pvcreate', True) for current_dev in devs_to_add: - rc, _, err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)]) + rc, dummy, err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)]) if rc == 0: changed = True else: module.fail_json(msg="Creating physical volume '%s' failed" % current_dev, rc=rc, err=err) # add PV to our VG vgextend_cmd = module.get_bin_path('vgextend', True) - rc, _, err = module.run_command("%s %s %s" % (vgextend_cmd, vg, devs_to_add_string)) + rc, dummy, err = module.run_command("%s %s %s" % (vgextend_cmd, vg, devs_to_add_string)) if rc == 0: changed = True else: @@ -315,7 +315,7 @@ def main(): if devs_to_remove: devs_to_remove_string = ' '.join(devs_to_remove) vgreduce_cmd = module.get_bin_path('vgreduce', True) - rc, _, err = module.run_command("%s --force %s %s" % (vgreduce_cmd, vg, devs_to_remove_string)) + rc, dummy, err = module.run_command("%s --force %s %s" % (vgreduce_cmd, vg, devs_to_remove_string)) if rc == 0: changed = True else: diff --git a/plugins/modules/system/lvol.py b/plugins/modules/system/lvol.py index 852d0f5cd7..bef515b8ec 100644 --- a/plugins/modules/system/lvol.py +++ b/plugins/modules/system/lvol.py @@ -447,7 +447,7 @@ def main(): cmd = "%s %s -%s %s%s %s -T %s/%s" % (lvcreate_cmd, yesopt, size_opt, size, size_unit, opts, vg, thinpool) else: cmd = "%s %s %s -n %s -%s %s%s %s %s %s" % (lvcreate_cmd, test_opt, yesopt, lv, size_opt, size, size_unit, opts, vg, pvs) - rc, _, err = module.run_command(cmd) + rc, dummy, err = module.run_command(cmd) if rc == 0: changed = True else: @@ -458,7 +458,7 @@ def main(): if not force: module.fail_json(msg="Sorry, no removal of logical volume %s without force=yes." % (this_lv['name'])) lvremove_cmd = module.get_bin_path("lvremove", required=True) - rc, _, err = module.run_command("%s %s --force %s/%s" % (lvremove_cmd, test_opt, vg, this_lv['name'])) + rc, dummy, err = module.run_command("%s %s --force %s/%s" % (lvremove_cmd, test_opt, vg, this_lv['name'])) if rc == 0: module.exit_json(changed=True) else: @@ -548,14 +548,14 @@ def main(): if this_lv is not None: if active: lvchange_cmd = module.get_bin_path("lvchange", required=True) - rc, _, err = module.run_command("%s -ay %s/%s" % (lvchange_cmd, vg, this_lv['name'])) + rc, dummy, err = module.run_command("%s -ay %s/%s" % (lvchange_cmd, vg, this_lv['name'])) if rc == 0: module.exit_json(changed=((not this_lv['active']) or changed), vg=vg, lv=this_lv['name'], size=this_lv['size']) else: module.fail_json(msg="Failed to activate logical volume %s" % (lv), rc=rc, err=err) else: lvchange_cmd = module.get_bin_path("lvchange", required=True) - rc, _, err = module.run_command("%s -an %s/%s" % (lvchange_cmd, vg, this_lv['name'])) + rc, dummy, err = module.run_command("%s -an %s/%s" % (lvchange_cmd, vg, this_lv['name'])) if rc == 0: module.exit_json(changed=(this_lv['active'] or changed), vg=vg, lv=this_lv['name'], size=this_lv['size']) else: diff --git a/plugins/modules/system/parted.py b/plugins/modules/system/parted.py index daf68c298a..bbb8c1408b 100644 --- a/plugins/modules/system/parted.py +++ b/plugins/modules/system/parted.py @@ -488,7 +488,7 @@ def check_parted_label(device): global parted_exec # Check the version - parted_major, parted_minor, _ = parted_version() + parted_major, parted_minor, dummy = parted_version() if (parted_major == 3 and parted_minor >= 1) or parted_major > 3: return False diff --git a/plugins/modules/system/timezone.py b/plugins/modules/system/timezone.py index d10dd9bb8b..6ab7d47052 100644 --- a/plugins/modules/system/timezone.py +++ b/plugins/modules/system/timezone.py @@ -117,7 +117,7 @@ class Timezone(object): # running in the global zone where changing the timezone has no effect. zonename_cmd = module.get_bin_path('zonename') if zonename_cmd is not None: - (rc, stdout, _) = module.run_command(zonename_cmd) + (rc, stdout, dummy) = module.run_command(zonename_cmd) if rc == 0 and stdout.strip() == 'global': module.fail_json(msg='Adjusting timezone is not supported in Global Zone') @@ -727,7 +727,7 @@ class BSDTimezone(Timezone): # Strategy 3: # (If /etc/localtime is not symlinked) # Check all files in /usr/share/zoneinfo and return first non-link match. - for dname, _, fnames in sorted(os.walk(zoneinfo_dir)): + for dname, dummy, fnames in sorted(os.walk(zoneinfo_dir)): for fname in sorted(fnames): zoneinfo_file = os.path.join(dname, fname) if not os.path.islink(zoneinfo_file) and filecmp.cmp(zoneinfo_file, localtime_file): diff --git a/plugins/modules/web_infrastructure/rundeck_acl_policy.py b/plugins/modules/web_infrastructure/rundeck_acl_policy.py index 1caa159b1a..8c2043d22c 100644 --- a/plugins/modules/web_infrastructure/rundeck_acl_policy.py +++ b/plugins/modules/web_infrastructure/rundeck_acl_policy.py @@ -173,9 +173,9 @@ class RundeckACLManager: if self.module.check_mode: self.module.exit_json(changed=True, before={}, after=self.module.params["policy"]) - _, info = self.request_rundeck_api("system/acl/%s.aclpolicy" % self.module.params["name"], - method="POST", - data={"contents": self.module.params["policy"]}) + dummy, info = self.request_rundeck_api("system/acl/%s.aclpolicy" % self.module.params["name"], + method="POST", + data={"contents": self.module.params["policy"]}) if info["status"] == 201: self.module.exit_json(changed=True, before={}, after=self.get_acl()) @@ -194,9 +194,9 @@ class RundeckACLManager: if self.module.check_mode: self.module.exit_json(changed=True, before=facts, after=facts) - _, info = self.request_rundeck_api("system/acl/%s.aclpolicy" % self.module.params["name"], - method="PUT", - data={"contents": self.module.params["policy"]}) + dummy, info = self.request_rundeck_api("system/acl/%s.aclpolicy" % self.module.params["name"], + method="PUT", + data={"contents": self.module.params["policy"]}) if info["status"] == 200: self.module.exit_json(changed=True, before=facts, after=self.get_acl()) diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 406e433863..300a12c7fd 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -1,5 +1,3 @@ -plugins/callback/hipchat.py pylint:blacklisted-name -plugins/connection/lxc.py pylint:blacklisted-name plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time plugins/module_utils/compat/ipaddress.py no-assert plugins/module_utils/compat/ipaddress.py no-unicode-literals @@ -63,7 +61,6 @@ plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elemen plugins/modules/cloud/linode/linode.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/linode/linode.py validate-modules:undocumented-parameter plugins/modules/cloud/linode/linode_v4.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/lxc/lxc_container.py pylint:blacklisted-name plugins/modules/cloud/lxc/lxc_container.py use-argspec-type-path plugins/modules/cloud/lxc/lxc_container.py validate-modules:invalid-ansiblemodule-schema plugins/modules/cloud/lxc/lxc_container.py validate-modules:use-run-command-not-popen @@ -236,7 +233,6 @@ plugins/modules/monitoring/logstash_plugin.py validate-modules:invalid-ansiblemo plugins/modules/monitoring/sensu/sensu_check.py validate-modules:parameter-list-no-elements plugins/modules/monitoring/sensu/sensu_client.py validate-modules:parameter-list-no-elements plugins/modules/monitoring/sensu/sensu_handler.py validate-modules:parameter-list-no-elements -plugins/modules/monitoring/statusio_maintenance.py pylint:blacklisted-name plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:parameter-type-not-in-doc # This triggers when a parameter is undocumented plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:undocumented-parameter # Parameter removed but reason for removal is shown by custom code plugins/modules/net_tools/ldap/ldap_entry.py validate-modules:doc-missing-type @@ -473,21 +469,10 @@ plugins/modules/storage/purestorage/purefa_facts.py validate-modules:parameter-l plugins/modules/storage/purestorage/purefa_facts.py validate-modules:return-syntax-error plugins/modules/storage/purestorage/purefb_facts.py validate-modules:parameter-list-no-elements plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error -plugins/modules/system/alternatives.py pylint:blacklisted-name -plugins/modules/system/beadm.py pylint:blacklisted-name -plugins/modules/system/cronvar.py pylint:blacklisted-name -plugins/modules/system/dconf.py pylint:blacklisted-name -plugins/modules/system/filesystem.py pylint:blacklisted-name -plugins/modules/system/gconftool2.py pylint:blacklisted-name plugins/modules/system/gconftool2.py validate-modules:parameter-state-invalid-choice -plugins/modules/system/interfaces_file.py pylint:blacklisted-name plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/java_cert.py pylint:blacklisted-name plugins/modules/system/launchd.py use-argspec-type-path # False positive -plugins/modules/system/lvg.py pylint:blacklisted-name -plugins/modules/system/lvol.py pylint:blacklisted-name plugins/modules/system/osx_defaults.py validate-modules:parameter-state-invalid-choice -plugins/modules/system/parted.py pylint:blacklisted-name plugins/modules/system/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/system/puppet.py use-argspec-type-path plugins/modules/system/puppet.py validate-modules:doc-default-does-not-match-spec # show_diff is not documented @@ -497,11 +482,9 @@ plugins/modules/system/puppet.py validate-modules:undocumented-parameter plugins/modules/system/runit.py validate-modules:doc-default-does-not-match-spec plugins/modules/system/runit.py validate-modules:parameter-type-not-in-doc plugins/modules/system/runit.py validate-modules:undocumented-parameter -plugins/modules/system/timezone.py pylint:blacklisted-name plugins/modules/system/xfconf.py validate-modules:parameter-state-invalid-choice plugins/modules/system/xfconf.py validate-modules:return-syntax-error plugins/modules/web_infrastructure/jenkins_plugin.py use-argspec-type-path -plugins/modules/web_infrastructure/rundeck_acl_policy.py pylint:blacklisted-name scripts/inventory/gce.py pylint:blacklisted-name tests/unit/plugins/module_utils/postgresql/test_postgres.py pylint:bad-option-value # a pylint test that is disabled was modified over time tests/unit/plugins/modules/cloud/google/test_gcp_forwarding_rule.py future-import-boilerplate diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index 7962d62c18..1d4d84faba 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -1,5 +1,3 @@ -plugins/callback/hipchat.py pylint:blacklisted-name -plugins/connection/lxc.py pylint:blacklisted-name plugins/module_utils/compat/ipaddress.py no-assert plugins/module_utils/compat/ipaddress.py no-unicode-literals plugins/module_utils/_mount.py future-import-boilerplate @@ -51,7 +49,6 @@ plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elemen plugins/modules/cloud/linode/linode.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/linode/linode.py validate-modules:undocumented-parameter plugins/modules/cloud/linode/linode_v4.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/lxc/lxc_container.py pylint:blacklisted-name plugins/modules/cloud/lxc/lxc_container.py use-argspec-type-path plugins/modules/cloud/lxc/lxc_container.py validate-modules:invalid-ansiblemodule-schema plugins/modules/cloud/lxc/lxc_container.py validate-modules:use-run-command-not-popen @@ -224,7 +221,6 @@ plugins/modules/monitoring/logstash_plugin.py validate-modules:invalid-ansiblemo plugins/modules/monitoring/sensu/sensu_check.py validate-modules:parameter-list-no-elements plugins/modules/monitoring/sensu/sensu_client.py validate-modules:parameter-list-no-elements plugins/modules/monitoring/sensu/sensu_handler.py validate-modules:parameter-list-no-elements -plugins/modules/monitoring/statusio_maintenance.py pylint:blacklisted-name plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:parameter-type-not-in-doc # This triggers when a parameter is undocumented plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:undocumented-parameter # Parameter removed but reason for removal is shown by custom code plugins/modules/net_tools/ldap/ldap_entry.py validate-modules:doc-missing-type @@ -461,21 +457,10 @@ plugins/modules/storage/purestorage/purefa_facts.py validate-modules:parameter-l plugins/modules/storage/purestorage/purefa_facts.py validate-modules:return-syntax-error plugins/modules/storage/purestorage/purefb_facts.py validate-modules:parameter-list-no-elements plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error -plugins/modules/system/alternatives.py pylint:blacklisted-name -plugins/modules/system/beadm.py pylint:blacklisted-name -plugins/modules/system/cronvar.py pylint:blacklisted-name -plugins/modules/system/dconf.py pylint:blacklisted-name -plugins/modules/system/filesystem.py pylint:blacklisted-name -plugins/modules/system/gconftool2.py pylint:blacklisted-name plugins/modules/system/gconftool2.py validate-modules:parameter-state-invalid-choice -plugins/modules/system/interfaces_file.py pylint:blacklisted-name plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/java_cert.py pylint:blacklisted-name plugins/modules/system/launchd.py use-argspec-type-path # False positive -plugins/modules/system/lvg.py pylint:blacklisted-name -plugins/modules/system/lvol.py pylint:blacklisted-name plugins/modules/system/osx_defaults.py validate-modules:parameter-state-invalid-choice -plugins/modules/system/parted.py pylint:blacklisted-name plugins/modules/system/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/system/puppet.py use-argspec-type-path plugins/modules/system/puppet.py validate-modules:doc-default-does-not-match-spec # show_diff is not documented @@ -485,11 +470,9 @@ plugins/modules/system/puppet.py validate-modules:undocumented-parameter plugins/modules/system/runit.py validate-modules:doc-default-does-not-match-spec plugins/modules/system/runit.py validate-modules:parameter-type-not-in-doc plugins/modules/system/runit.py validate-modules:undocumented-parameter -plugins/modules/system/timezone.py pylint:blacklisted-name plugins/modules/system/xfconf.py validate-modules:parameter-state-invalid-choice plugins/modules/system/xfconf.py validate-modules:return-syntax-error plugins/modules/web_infrastructure/jenkins_plugin.py use-argspec-type-path -plugins/modules/web_infrastructure/rundeck_acl_policy.py pylint:blacklisted-name tests/unit/plugins/modules/cloud/google/test_gcp_forwarding_rule.py future-import-boilerplate tests/unit/plugins/modules/cloud/google/test_gcp_forwarding_rule.py metaclass-boilerplate tests/utils/shippable/check_matrix.py replace-urlopen diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 3089b178d3..cf71b82c8f 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -1,5 +1,3 @@ -plugins/callback/hipchat.py pylint:blacklisted-name -plugins/connection/lxc.py pylint:blacklisted-name plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time plugins/module_utils/compat/ipaddress.py no-assert plugins/module_utils/compat/ipaddress.py no-unicode-literals @@ -53,7 +51,6 @@ plugins/modules/cloud/kubevirt/kubevirt_rs.py validate-modules:parameter-type-no plugins/modules/cloud/kubevirt/kubevirt_vm.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/linode/linode.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/linode/linode.py validate-modules:undocumented-parameter -plugins/modules/cloud/lxc/lxc_container.py pylint:blacklisted-name plugins/modules/cloud/lxc/lxc_container.py use-argspec-type-path plugins/modules/cloud/lxc/lxc_container.py validate-modules:use-run-command-not-popen plugins/modules/cloud/misc/helm.py validate-modules:deprecation-mismatch @@ -232,7 +229,6 @@ plugins/modules/files/iso_extract.py validate-modules:doc-default-does-not-match plugins/modules/identity/opendj/opendj_backendprop.py validate-modules:doc-missing-type plugins/modules/identity/opendj/opendj_backendprop.py validate-modules:parameter-type-not-in-doc plugins/modules/monitoring/icinga2_host.py validate-modules:undocumented-parameter -plugins/modules/monitoring/statusio_maintenance.py pylint:blacklisted-name plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:deprecation-mismatch plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:invalid-documentation plugins/modules/net_tools/ldap/ldap_attr.py validate-modules:parameter-type-not-in-doc @@ -447,19 +443,8 @@ plugins/modules/storage/purestorage/purefa_facts.py validate-modules:return-synt plugins/modules/storage/purestorage/purefb_facts.py validate-modules:deprecation-mismatch plugins/modules/storage/purestorage/purefb_facts.py validate-modules:invalid-documentation plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error -plugins/modules/system/alternatives.py pylint:blacklisted-name -plugins/modules/system/beadm.py pylint:blacklisted-name -plugins/modules/system/cronvar.py pylint:blacklisted-name -plugins/modules/system/dconf.py pylint:blacklisted-name -plugins/modules/system/filesystem.py pylint:blacklisted-name -plugins/modules/system/gconftool2.py pylint:blacklisted-name -plugins/modules/system/interfaces_file.py pylint:blacklisted-name plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/java_cert.py pylint:blacklisted-name plugins/modules/system/launchd.py use-argspec-type-path # False positive -plugins/modules/system/lvg.py pylint:blacklisted-name -plugins/modules/system/lvol.py pylint:blacklisted-name -plugins/modules/system/parted.py pylint:blacklisted-name plugins/modules/system/puppet.py use-argspec-type-path plugins/modules/system/puppet.py validate-modules:parameter-invalid plugins/modules/system/puppet.py validate-modules:parameter-type-not-in-doc @@ -467,12 +452,10 @@ plugins/modules/system/puppet.py validate-modules:undocumented-parameter plugins/modules/system/runit.py validate-modules:doc-default-does-not-match-spec plugins/modules/system/runit.py validate-modules:parameter-type-not-in-doc plugins/modules/system/runit.py validate-modules:undocumented-parameter -plugins/modules/system/timezone.py pylint:blacklisted-name plugins/modules/system/xfconf.py validate-modules:return-syntax-error plugins/modules/web_infrastructure/jenkins_plugin.py use-argspec-type-path plugins/modules/web_infrastructure/nginx_status_facts.py validate-modules:deprecation-mismatch plugins/modules/web_infrastructure/nginx_status_facts.py validate-modules:invalid-documentation -plugins/modules/web_infrastructure/rundeck_acl_policy.py pylint:blacklisted-name scripts/inventory/gce.py pylint:blacklisted-name tests/unit/plugins/module_utils/postgresql/test_postgres.py pylint:bad-option-value # a pylint test that is disabled was modified over time tests/unit/plugins/modules/cloud/google/test_gcp_forwarding_rule.py future-import-boilerplate