From 3e3f82c461a69fb35654e9e29b321fdf83bd75f0 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Thu, 29 Apr 2021 14:25:07 -0300 Subject: [PATCH] Fix pylint warning W0613: unused-argument. --- .../module_utils/ansible_freeipa_module.py | 6 ++-- plugins/modules/ipadnszone.py | 12 +++---- plugins/modules/ipahost.py | 4 +-- plugins/modules/ipatrust.py | 2 +- plugins/modules/ipauser.py | 19 +++++------ plugins/modules/ipavault.py | 32 +++++++++---------- 6 files changed, 35 insertions(+), 40 deletions(-) diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py index 6ce9749e..9a040ad0 100644 --- a/plugins/module_utils/ansible_freeipa_module.py +++ b/plugins/module_utils/ansible_freeipa_module.py @@ -202,11 +202,11 @@ else: if not backend.isconnected(): backend.connect(ccache=os.environ.get('KRB5CCNAME', None)) - def api_command(module, command, name, args): + def api_command(_module, command, name, args): """Call ipa.Command.""" return api.Command[command](name, **args) - def api_command_no_name(module, command, args): + def api_command_no_name(_module, command, args): """Call ipa.Command without a name.""" return api.Command[command](**args) @@ -805,7 +805,7 @@ else: self.process_command_result(name, command, args, result) self.get_command_errors(command, result) - def process_command_result(self, name, command, args, result): + def process_command_result(self, _name, _command, _args, result): """ Process an API command result. diff --git a/plugins/modules/ipadnszone.py b/plugins/modules/ipadnszone.py index 8500eb14..dbaa331b 100644 --- a/plugins/modules/ipadnszone.py +++ b/plugins/modules/ipadnszone.py @@ -298,7 +298,7 @@ class DNSZoneModule(FreeIPABaseModule): return True - def get_ipa_nsec3paramrecord(self, **kwargs): + def get_ipa_nsec3paramrecord(self, **_kwargs): nsec3param_rec = self.ipa_params.nsec3param_rec if nsec3param_rec is not None: error_msg = ( @@ -310,7 +310,7 @@ class DNSZoneModule(FreeIPABaseModule): self.fail_json(msg=error_msg) return nsec3param_rec - def get_ipa_idnsforwarders(self, **kwargs): + def get_ipa_idnsforwarders(self, **_kwargs): if self.ipa_params.forwarders is not None: forwarders = [] for forwarder in self.ipa_params.forwarders: @@ -334,14 +334,14 @@ class DNSZoneModule(FreeIPABaseModule): return forwarders - def get_ipa_idnsallowtransfer(self, **kwargs): + def get_ipa_idnsallowtransfer(self, **_kwargs): if self.ipa_params.allow_transfer is not None: error_msg = "Invalid ip_address for DNS allow_transfer: %s" self.validate_ips(self.ipa_params.allow_transfer, error_msg) return (";".join(self.ipa_params.allow_transfer) or "none") + ";" - def get_ipa_idnsallowquery(self, **kwargs): + def get_ipa_idnsallowquery(self, **_kwargs): if self.ipa_params.allow_query is not None: error_msg = "Invalid ip_address for DNS allow_query: %s" self.validate_ips(self.ipa_params.allow_query, error_msg) @@ -364,13 +364,13 @@ class DNSZoneModule(FreeIPABaseModule): return ".".join((name, domain)) - def get_ipa_idnssoarname(self, **kwargs): + def get_ipa_idnssoarname(self, **_kwargs): if self.ipa_params.admin_email is not None: return DNSName( self._replace_at_symbol_in_rname(self.ipa_params.admin_email) ) - def get_ipa_idnssoamname(self, **kwargs): + def get_ipa_idnssoamname(self, **_kwargs): if self.ipa_params.name_server is not None: return DNSName(self.ipa_params.name_server) diff --git a/plugins/modules/ipahost.py b/plugins/modules/ipahost.py index 4bf7c47c..5864e180 100644 --- a/plugins/modules/ipahost.py +++ b/plugins/modules/ipahost.py @@ -466,7 +466,7 @@ def show_host(module, name): def gen_args(description, locality, location, platform, os, password, random, mac_address, sshpubkey, userclass, auth_ind, requires_pre_auth, - ok_as_delegate, ok_to_auth_as_delegate, force, reverse, + ok_as_delegate, ok_to_auth_as_delegate, force, _reverse, ip_address, update_dns): # certificate, managedby_host, principal, create_keytab_* and # allow_retrieve_keytab_* are not handled here @@ -529,7 +529,7 @@ def gen_dnsrecord_args(module, ip_address, reverse): return _args -def check_parameters( +def check_parameters( # pylint: disable=unused-argument module, state, action, description, locality, location, platform, os, password, random, certificate, managedby_host, principal, allow_create_keytab_user, diff --git a/plugins/modules/ipatrust.py b/plugins/modules/ipatrust.py index c48dcb41..80eb3ea8 100644 --- a/plugins/modules/ipatrust.py +++ b/plugins/modules/ipatrust.py @@ -153,7 +153,7 @@ def add_trust(module, realm, args): def gen_args(trust_type, admin, password, server, trust_secret, base_id, - range_size, range_type, two_way, external): + range_size, _range_type, two_way, external): _args = {} if trust_type is not None: _args["trust_type"] = trust_type diff --git a/plugins/modules/ipauser.py b/plugins/modules/ipauser.py index 52463abb..2e80811a 100644 --- a/plugins/modules/ipauser.py +++ b/plugins/modules/ipauser.py @@ -599,17 +599,14 @@ def gen_args(first, last, fullname, displayname, initials, homedir, shell, return _args -def check_parameters(module, state, action, - first, last, fullname, displayname, initials, homedir, - shell, email, principal, principalexpiration, - passwordexpiration, password, random, uid, gid, city, - phone, mobile, pager, fax, orgunit, title, manager, - carlicense, sshpubkey, userauthtype, userclass, radius, - radiususer, departmentnumber, employeenumber, - employeetype, preferredlanguage, certificate, - certmapdata, noprivate, nomembers, preserve, - update_password): - +def check_parameters( # pylint: disable=unused-argument + module, state, action, first, last, fullname, displayname, initials, + homedir, shell, email, principal, principalexpiration, + passwordexpiration, password, random, uid, gid, city, phone, mobile, + pager, fax, orgunit, title, manager, carlicense, sshpubkey, + userauthtype, userclass, radius, radiususer, departmentnumber, + employeenumber, employeetype, preferredlanguage, certificate, + certmapdata, noprivate, nomembers, preserve, update_password): if state == "present": if action == "member": invalid = ["first", "last", "fullname", "displayname", "initials", diff --git a/plugins/modules/ipavault.py b/plugins/modules/ipavault.py index 1a4efb4b..df4bdf28 100644 --- a/plugins/modules/ipavault.py +++ b/plugins/modules/ipavault.py @@ -348,9 +348,9 @@ def find_vault(module, name, username, service, shared): return None -def gen_args(description, username, service, shared, vault_type, salt, - password, password_file, public_key, public_key_file, vault_data, - datafile_in, datafile_out): +def gen_args( + description, username, service, shared, vault_type, salt, + public_key, public_key_file): _args = {} vault_type = vault_type or to_text("symmetric") @@ -443,12 +443,12 @@ def data_storage_args(vault_type, args, data, password, password_file, return _args -def check_parameters(module, state, action, description, username, service, - shared, users, groups, services, owners, ownergroups, - ownerservices, vault_type, salt, password, password_file, - public_key, public_key_file, private_key, - private_key_file, vault_data, datafile_in, datafile_out, - new_password, new_password_file): +def check_parameters( # pylint: disable=unused-argument + module, state, action, description, username, service, shared, users, + groups, services, owners, ownergroups, ownerservices, vault_type, salt, + password, password_file, public_key, public_key_file, private_key, + private_key_file, vault_data, datafile_in, datafile_out, new_password, + new_password_file): invalid = [] if state == "present": invalid = ['datafile_out'] @@ -491,11 +491,11 @@ def check_parameters(module, state, action, description, username, service, "action '%s'" % (arg, state, action)) -def check_encryption_params(module, state, action, vault_type, salt, - password, password_file, public_key, - public_key_file, private_key, private_key_file, - vault_data, datafile_in, datafile_out, - new_password, new_password_file, res_find): +def check_encryption_params( # pylint: disable=unused-argument + module, state, action, vault_type, salt, password, password_file, + public_key, public_key_file, private_key, private_key_file, vault_data, + datafile_in, datafile_out, new_password, new_password_file, res_find): + """Check parameters used for (de)vault data encryption.""" vault_type_invalid = [] existing_type = None @@ -757,9 +757,7 @@ def main(): # Generate args args = gen_args(description, username, service, shared, vault_type, - salt, password, password_file, public_key, - public_key_file, vault_data, datafile_in, - datafile_out) + salt, public_key, public_key_file) pwdargs = None # Create command -- GitLab