-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: netaddr is_private method deprecation #338
Conversation
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 41s |
LGTM; this would fix our problems as well. Need a review from a reviewer though. |
LGTM; this would fix our problems as well. Need a review from a reviewer though. |
Hi, ipaddr_result3:
- 192.24.2.1
- 2001:db8:32c:faad::/64 The IPv6 is reserved for documentation purposes and is not globally reachable and cannot be assigned by an isp (https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml). Therefore we can deduce that is not "public". The range is also present in netaddr ip class https://github.com/netaddr/netaddr/blob/master/netaddr/ip/__init__.py#L2067. Finally, please do note that About PR I don't know how the value Thank you |
Hi, anynews on the PR? |
@rizlas could you please add changelog |
Yeah, on it! Thank you |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 7m 31s |
Should I also change this to Edit: I changed netaddr minimum version. I'll just revert if you don't like it 😅 |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 36s |
net/py-netaddr 1.2.1 deprecated and removed the is_private method. This breaks ansible-collections which is bundled this port's tarball. The upstream patch uses the is_global methhod instead. Reported by: Einar Bjarni Halldorsson <einar@isnic.is> Obtained from: ansible-collections/ansible.utils#338
net/py-netaddr 1.2.1 deprecated and removed the is_private method. This breaks ansible-collections which is bundled this port's tarball. The upstream patch uses the is_global methhod instead. Reported by: Einar Bjarni Halldorsson <einar@isnic.is> Obtained from: ansible-collections/ansible.utils#338 (cherry picked from commit 698ed6d)
SUMMARY
Fix: #331
Netaddr has removed is_private method. This PR aims to fix it using is_global method instead that support both IPv4 and IPv6.
First argument of _private_query is IPNetwork that's why
.ip (v.ip)
attribute is used. Otherwiseis_global
function is not available (see below for more infos).Backward compatibility is maintained till netaddr 0.10.0. Not before.
Netaddr changelog: https://netaddr.readthedocs.io/en/latest/changes.html#release-1-0-0
ISSUE TYPE
COMPONENT NAME
ipaddr_utils.py
ADDITIONAL INFORMATION
Install netaddr > 1.0.0 and use
ansible.utils.ipaddr('private')
to reproduce.Object attributes of
IPNetwork.ip
(only notable):'ipv4', 'ipv6', 'is_global', 'is_hostmask', 'is_ipv4_compat', 'is_ipv4_mapped', 'is_ipv4_private_use', 'is_ipv6_unique_local', 'is_link_local', 'is_loopback', 'is_multicast', 'is_netmask', 'is_reserved', 'is_unicast'
Object attributes of
IPAddress
class (only notable):'ipv4', 'ipv6', 'is_global', 'is_hostmask', 'is_ipv4_compat', 'is_ipv4_mapped', 'is_ipv4_private_use', 'is_ipv6_unique_local', 'is_link_local', 'is_loopback', 'is_multicast', 'is_netmask', 'is_reserved', 'is_unicast'