mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Address inconsistent-return-statements
Pylint warns about inconsistent return statements when some paths of a function return None implicitly. Make all implicit returns either explicit or raise a proper exception. See: https://pagure.io/freeipa/issue/7758 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
@@ -60,3 +60,4 @@ else:
|
||||
else:
|
||||
logger.error("IPA does not work with the threaded MPM, "
|
||||
"use the pre-fork MPM")
|
||||
raise RuntimeError('threaded MPM detected')
|
||||
|
||||
@@ -52,6 +52,7 @@ class build_py(setuptools_build_py):
|
||||
os.unlink(outfile)
|
||||
except OSError:
|
||||
pass
|
||||
return None
|
||||
else:
|
||||
return setuptools_build_py.build_module(self, module,
|
||||
module_file, package)
|
||||
|
||||
@@ -1377,12 +1377,10 @@ def run_repeatedly(host, command, assert_zero_rc=True, test=None,
|
||||
|
||||
|
||||
def get_host_ip_with_hostmask(host):
|
||||
"""
|
||||
Detects the IP of the host including the hostmask.
|
||||
"""Detects the IP of the host including the hostmask
|
||||
|
||||
Returns None if the IP could not be detected.
|
||||
"""
|
||||
|
||||
ip = host.ip
|
||||
result = host.run_command(['ip', 'addr'])
|
||||
full_ip_regex = r'(?P<full_ip>%s/\d{1,2}) ' % re.escape(ip)
|
||||
@@ -1390,6 +1388,8 @@ def get_host_ip_with_hostmask(host):
|
||||
|
||||
if match:
|
||||
return match.group('full_ip')
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def ldappasswd_user_change(user, oldpw, newpw, master):
|
||||
|
||||
@@ -66,6 +66,8 @@ class CLITestContext:
|
||||
return False
|
||||
self.exception = exc_value
|
||||
return True
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def test_ipa_help():
|
||||
|
||||
@@ -25,6 +25,7 @@ def find_segment(master, replica):
|
||||
for segment in allsegments:
|
||||
if master.hostname in segment and replica.hostname in segment:
|
||||
return '-to-'.join(segment)
|
||||
return None
|
||||
|
||||
|
||||
@pytest.mark.skipif(config.domain_level == 0, reason=reasoning)
|
||||
|
||||
@@ -206,6 +206,8 @@ class test_Command(ClassChecker):
|
||||
def __call__(self, _, value):
|
||||
if value != self.name:
|
||||
return _('must equal %r') % self.name
|
||||
else:
|
||||
return None
|
||||
|
||||
default_from = parameters.DefaultFrom(
|
||||
lambda arg: arg,
|
||||
|
||||
@@ -187,13 +187,15 @@ def test_entry_to_dict():
|
||||
class FakeSchema:
|
||||
def get_obj(self, type, name):
|
||||
if type != ldap.schema.AttributeType:
|
||||
return
|
||||
return None
|
||||
if name == 'binaryattr':
|
||||
return FakeAttributeType(name, '1.3.6.1.4.1.1466.115.121.1.40')
|
||||
elif name == 'textattr':
|
||||
return FakeAttributeType(name, '1.3.6.1.4.1.1466.115.121.1.15')
|
||||
elif name == 'dnattr':
|
||||
return FakeAttributeType(name, '1.3.6.1.4.1.1466.115.121.1.12')
|
||||
else:
|
||||
return None
|
||||
|
||||
class FakeLDAPClient(ipaldap.LDAPClient):
|
||||
def __init__(self):
|
||||
|
||||
@@ -272,9 +272,10 @@ class EWE:
|
||||
if self.expected and self.returned:
|
||||
assert_deepequal(self.expected, self.value)
|
||||
elif self.expected:
|
||||
assert False, "Value expected but not provided"
|
||||
raise AssertionError("Value expected but not provided")
|
||||
elif self.returned:
|
||||
assert False, "Value provided but not expected"
|
||||
raise AssertionError("Value provided but not expected")
|
||||
return None
|
||||
|
||||
|
||||
def permissions_idfn(perms):
|
||||
|
||||
@@ -87,6 +87,8 @@ def assert_realmdomain_and_txt_record_not_present(response):
|
||||
api.Command['dnsrecord_show'](zone, u'_kerberos')
|
||||
except errors.NotFound:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
|
||||
Reference in New Issue
Block a user