From: Aaron Rosen Date: Wed, 16 Apr 2014 18:31:25 +0000 (-0700) Subject: netaddr<=0.7.10 raises ValueError instead of AddrFormatError X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a1ff2b5d80a7f8e9c2e6e5bf638e8dc47b60e5af;p=openstack-build%2Fneutron-build.git netaddr<=0.7.10 raises ValueError instead of AddrFormatError This patch ensures that ValueError is also caught in addition to AddrFormatError as in netaddr>=0.7.11 AddrFormatError is raised and in netaddr<=0.7.10 ValueError is raised. Change-Id: I595c90e42129a2d365f3860e3042e826bd031365 Closes-bug: #1308675 (cherry picked from commit dd2ccd12adfb6c7d4aa500ba4120f767beeed35c) --- diff --git a/neutron/extensions/securitygroup.py b/neutron/extensions/securitygroup.py index 637dbe3d7..37031e27e 100644 --- a/neutron/extensions/securitygroup.py +++ b/neutron/extensions/securitygroup.py @@ -164,7 +164,7 @@ def convert_ip_prefix_to_cidr(ip_prefix): try: cidr = netaddr.IPNetwork(ip_prefix) return str(cidr) - except (TypeError, netaddr.AddrFormatError): + except (ValueError, TypeError, netaddr.AddrFormatError): raise qexception.InvalidCIDR(input=ip_prefix)