Merge "Remove single occurrence of lost-exception warning"
This commit is contained in:
@@ -47,7 +47,6 @@ disable=
|
|||||||
global-statement,
|
global-statement,
|
||||||
global-variable-not-assigned,
|
global-variable-not-assigned,
|
||||||
logging-not-lazy,
|
logging-not-lazy,
|
||||||
lost-exception,
|
|
||||||
no-init,
|
no-init,
|
||||||
non-parent-init-called,
|
non-parent-init-called,
|
||||||
pointless-string-statement,
|
pointless-string-statement,
|
||||||
|
|||||||
@@ -151,19 +151,17 @@ def _validate_no_whitespace(data):
|
|||||||
|
|
||||||
|
|
||||||
def _validate_mac_address(data, valid_values=None):
|
def _validate_mac_address(data, valid_values=None):
|
||||||
valid_mac = False
|
|
||||||
try:
|
try:
|
||||||
valid_mac = netaddr.valid_mac(_validate_no_whitespace(data))
|
valid_mac = netaddr.valid_mac(_validate_no_whitespace(data))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
valid_mac = False
|
||||||
finally:
|
# TODO(arosen): The code in this file should be refactored
|
||||||
# TODO(arosen): The code in this file should be refactored
|
# so it catches the correct exceptions. _validate_no_whitespace
|
||||||
# so it catches the correct exceptions. _validate_no_whitespace
|
# raises AttributeError if data is None.
|
||||||
# raises AttributeError if data is None.
|
if not valid_mac:
|
||||||
if valid_mac is False:
|
msg = _("'%s' is not a valid MAC address") % data
|
||||||
msg = _("'%s' is not a valid MAC address") % data
|
LOG.debug(msg)
|
||||||
LOG.debug(msg)
|
return msg
|
||||||
return msg
|
|
||||||
|
|
||||||
|
|
||||||
def _validate_mac_address_or_none(data, valid_values=None):
|
def _validate_mac_address_or_none(data, valid_values=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user