Merge "netaddr: fix IP conversion issues with netaddr>1.0.0"

This commit is contained in:
Zuul 2024-09-04 10:34:47 +00:00 committed by Gerrit Code Review
commit 84a921d2e9

View File

@ -89,7 +89,11 @@ class IPField(fields.Field):
try: try:
if self.mask: if self.mask:
self.ip = netaddr.IPNetwork(value) try:
self.ip = netaddr.IPNetwork(value.strip())
except netaddr.AddrFormatError:
self.ip = netaddr.IPNetwork(
netaddr.cidr_abbrev_to_verbose(value.strip()))
else: else:
self.ip = netaddr.IPAddress(value) self.ip = netaddr.IPAddress(value)
except Exception: except Exception: