#9645 support for python module netaddr 1.3.0
Closed: fixed by frenaud. Opened by sin.

Modern releases of netaddr (older than version 1.0.0) doesn't support same flags in IPAddress and IPNetwork classes:

  • https://netaddr.readthedocs.io/en/latest/changes.html#release-1-0-0
  • https://netaddr.readthedocs.io/en/latest/api.html#netaddr.IPNetwork

class netaddr.IPNetwork(addr, version=None, flags=0, *, expand_partial=False)
[...]
flags – (optional) decides which rules are applied to the interpretation of the addr value. Currently only supports the NOHOST option.

So, build tests fails on test_ip_address with python module netaddr-1.3.0, for example:

=================================== FAILURES ===================================
__________________ test_ip_address[10.11.12.13/14-words2-14] ___________________
self = <[AttributeError("'CheckedIPAddress' object has no attribute '_module'") raised in repr()] CheckedIPAddress object at 0x7f839a75c910>
addr = '10.11.12.13/14'
    def __init__(self, addr):
        if isinstance(addr, UnsafeIPAddress):
            self._net = addr._net
            super(UnsafeIPAddress, self).__init__(addr,
                                                  flags=self.netaddr_ip_flags)
            return
        elif isinstance(addr, netaddr.IPAddress):
            self._net = None  # no information about netmask
            super(UnsafeIPAddress, self).__init__(addr,
                                                  flags=self.netaddr_ip_flags)
            return
        elif isinstance(addr, netaddr.IPNetwork):
            self._net = addr
            super(UnsafeIPAddress, self).__init__(self._net.ip,
                                                  flags=self.netaddr_ip_flags)
            return
        # option of last resort: parse it as string
        self._net = None
        addr = str(addr)
        try:
            try:
>               addr = netaddr.IPAddress(addr, flags=self.netaddr_ip_flags)
../ipapython/ipautil.py:110:
...
FAILED test_ipapython/test_ipautil.py::test_ip_address[10.11.12.13/14-words2-14]
FAILED test_ipapython/test_ipautil.py::test_ip_address[10.11.12.0/24-words10-24]
FAILED test_ipapython/test_ipautil.py::test_ip_address[10.11.12.255/24-words13-24]
FAILED test_ipapython/test_ipautil.py::test_ip_address[2001::1/72-words17-72]
FAILED test_ipapython/test_ipautil.py::test_ip_address[2001::/64-words25-64]
====== 5 failed, 653 passed, 269 skipped, 1 xfailed, 54 warnings in 8.03s ======

Submitted https://github.com/freeipa/freeipa/pull/7482

Metadata Update from @frenaud:
- Issue assigned to frenaud

Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/7535

master:

  • 19651f8ecc1aba69f96817e676e1dd953bc640ec azure tests: move to fedora 40
  • a4a0a142058a45ab2bf614c14c1b037b674cccc9 UnsafeIPAddress: pass flag=0 to IPNetwork
  • 97718f688c73265c0240fbe6380cf0476e873395 azure pipeline: use latest version of DownloadPipelineArtifact task

ipa-4-12:

  • 32a46d1acef1360c6737a702675ea170fe50d5ba azure tests: move to fedora 40
  • a9e653ca36a0829ae59cd204e7388d7a6c91e082 UnsafeIPAddress: pass flag=0 to IPNetwork
  • 8a8fb11447a76b835c7ec5e51e01ccb26b0906ba azure pipeline: use latest version of DownloadPipelineArtifact task

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata Update from @frenaud:
- Custom field rhbz adjusted to https://issues.redhat.com/browse/RHEL-59659

Metadata Update from @frenaud:
- Custom field rhbz adjusted to https://issues.redhat.com/browse/RHEL-59659, https://issues.redhat.com/browse/RHEL-67414 (was: https://issues.redhat.com/browse/RHEL-59659)

Metadata