Merge "is_valid_ip_address: Catch non-string values early"

This commit is contained in:
Zuul 2024-02-20 21:57:34 +00:00 committed by Gerrit Code Review
commit 25d923925a
1 changed files with 3 additions and 0 deletions

View File

@ -292,6 +292,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