Comment 4 for bug 1307733

Revision history for this message
Adam Stokes (adam-stokes) wrote :

James,

I looked into using this module in our cloud installer, one bug in particular that exists in 0.7.10 but not in 0.7.13 is the use of sys.maxint:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/share/openstack/cloudinstall/netutils.py", line 78, in get_ip_set
    ips = list(IPSet([cidr]))
  File "/usr/lib/python3/dist-packages/netaddr/ip/sets.py", line 518, in __len__
    if size > _sys.maxint:
AttributeError: 'module' object has no attribute 'maxint'

Code to reproduce:
from netaddr import IPSet
def get_ip_set(cidr):
    """ Returns a list of ip's in cidr for use in juju's no-proxy setting
    """
    ips = list(IPSet([cidr]))
    return ",".join(str(x) for x in ips)

get_ip_set('10.0.4.0/24')