is_valid_ip_address: Catch non-string values early
The is_valid_ipvN methods from oslo.utils raises an exception for non-string values, because of the change in netaddr 1.0.0. This adds a wrapper logic to retain the previous behavior, which is preferred by manila. Change-Id: If1297e4d54fd645969ca79690a1c558c9efdbc8d
This commit is contained in:
parent
05a231e370
commit
c3b8afc47a
|
@ -390,6 +390,9 @@ def is_valid_ip_address(ip_address, ip_version):
|
|||
raise exception.ManilaException(
|
||||
_("Provided improper IP version '%s'.") % ip_version)
|
||||
|
||||
if not isinstance(ip_address, str):
|
||||
return False
|
||||
|
||||
if 4 in ip_version:
|
||||
if netutils.is_valid_ipv4(ip_address):
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue