mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
+12
-1
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user