Fix pylint warnings inconsistent-return-statements

Add consistent return to all functions and methods that are covered by
tox -e pylint[23]. I haven't checked if return None is always a good
idea or if we should rather raise an error.

See: https://pagure.io/freeipa/issue/7326
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Christian Heimes
2017-12-18 11:51:14 +01:00
parent a7ae2dbc5f
commit 8cb756a229
14 changed files with 85 additions and 26 deletions
+12 -1
View File
@@ -452,11 +452,15 @@ def validate_hostname(hostname, check_fqdn=True, allow_underscore=False, allow_s
def normalize_sshpubkey(value):
return SSHPublicKey(value).openssh()
def validate_sshpubkey(ugettext, value):
try:
SSHPublicKey(value)
except (ValueError, UnicodeDecodeError):
return _('invalid SSH public key')
else:
return None
def validate_sshpubkey_no_options(ugettext, value):
try:
@@ -466,6 +470,8 @@ def validate_sshpubkey_no_options(ugettext, value):
if pubkey.has_options():
return _('options are not allowed')
else:
return None
def convert_sshpubkey_post(entry_attrs):
@@ -685,18 +691,23 @@ def get_reverse_zone_default(ip_address):
return normalize_zone('.'.join(items))
def validate_rdn_param(ugettext, value):
try:
RDN(value)
except Exception as e:
return str(e)
return None
else:
return None
def validate_hostmask(ugettext, hostmask):
try:
netaddr.IPNetwork(hostmask)
except (ValueError, AddrFormatError):
return _('invalid hostmask')
else:
return None
class ForwarderValidationError(Exception):