mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 22:03:18 +00:00
Fix or disable pylint's no-else-return.
Fixed usage of `else` right after return, or disable pylint evaluation when it would play against code readability.
This commit is contained in:
@@ -315,7 +315,7 @@ else:
|
||||
filtered_args = [key for key in args if key not in ignore]
|
||||
|
||||
for key in filtered_args:
|
||||
if key not in ipa:
|
||||
if key not in ipa: # pylint: disable=no-else-return
|
||||
module.debug(
|
||||
base_debug_msg + "Command key not present in IPA: %s" % key
|
||||
)
|
||||
@@ -367,15 +367,13 @@ else:
|
||||
if value is not None:
|
||||
if isinstance(value, list):
|
||||
return [_afm_convert(x) for x in value]
|
||||
elif isinstance(value, dict):
|
||||
if isinstance(value, dict):
|
||||
return {_afm_convert(k): _afm_convert(v)
|
||||
for k, v in value.items()}
|
||||
elif isinstance(value, str):
|
||||
if isinstance(value, str):
|
||||
return to_text(value)
|
||||
else:
|
||||
return value
|
||||
else:
|
||||
return value
|
||||
|
||||
return value
|
||||
|
||||
def module_params_get(module, name):
|
||||
return _afm_convert(module.params.get(name))
|
||||
@@ -465,11 +463,10 @@ else:
|
||||
def DN_x500_text(text): # pylint: disable=invalid-name
|
||||
if hasattr(DN, "x500_text"):
|
||||
return DN(text).x500_text()
|
||||
else:
|
||||
# Emulate x500_text
|
||||
dn = DN(text)
|
||||
dn.rdns = reversed(dn.rdns)
|
||||
return str(dn)
|
||||
# Emulate x500_text
|
||||
dn = DN(text)
|
||||
dn.rdns = reversed(dn.rdns)
|
||||
return str(dn)
|
||||
|
||||
def is_valid_port(port):
|
||||
if not isinstance(port, int):
|
||||
|
||||
@@ -114,8 +114,8 @@ def find_dnsconfig(module):
|
||||
if _result["result"].get('idnsforwarders', None) is None:
|
||||
_result["result"]['idnsforwarders'] = ['']
|
||||
return _result["result"]
|
||||
else:
|
||||
module.fail_json(msg="Could not retrieve current DNS configuration.")
|
||||
|
||||
module.fail_json(msg="Could not retrieve current DNS configuration.")
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -404,10 +404,9 @@ class DNSZoneModule(FreeIPABaseModule):
|
||||
ip_version = ip.version
|
||||
if ip_version == 4:
|
||||
return u'.'.join(items[4 - prefixlen // 8:])
|
||||
elif ip_version == 6:
|
||||
if ip_version == 6:
|
||||
return u'.'.join(items[32 - prefixlen // 4:])
|
||||
else:
|
||||
self.fail_json(msg="Invalid IP version for reverse zone.")
|
||||
self.fail_json(msg="Invalid IP version for reverse zone.")
|
||||
|
||||
def get_zone(self, zone_name):
|
||||
get_zone_args = {"idnsname": zone_name, "all": True}
|
||||
|
||||
@@ -121,7 +121,7 @@ def find_hbacsvcgroup(module, name):
|
||||
msg="There is more than one hbacsvcgroup '%s'" % (name))
|
||||
elif len(_result["result"]) == 1:
|
||||
return _result["result"][0]
|
||||
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -250,8 +250,8 @@ def find_service(module, name):
|
||||
_res["usercertificate"] = [encode_certificate(cert) for
|
||||
cert in certs]
|
||||
return _res
|
||||
else:
|
||||
return None
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def gen_args(pac_type, auth_ind, skip_host_check, force, requires_pre_auth,
|
||||
|
||||
Reference in New Issue
Block a user