Index | Thread | Search

From:
Florian Obser <florian@openbsd.org>
Subject:
py3-netaddr-1.0.0 breaks ansible.utils.ipaddr('public')
To:
Stuart Henderson <sthen@openbsd.org>, Pavel Korovin <pvk@openbsd.org>
Cc:
ports <ports@openbsd.org>
Date:
Tue, 13 Feb 2024 14:09:59 +0100

Download raw body.

Thread
thusly:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'IPAddress' object has no attribute 'is_private'

See also: https://github.com/ansible-collections/ansible.utils/issues/331

This fixes it for me for now, but I didn't have the time to give it both
buttocks, so pretty much half-arsed.

diff --git sysutils/ansible/Makefile sysutils/ansible/Makefile
index 25f922d3ab4..64da78d9e52 100644
--- sysutils/ansible/Makefile
+++ sysutils/ansible/Makefile
@@ -1,6 +1,7 @@
 COMMENT =		radically simple IT automation
 
 MODPY_EGG_VERSION =	9.2.0
+REVISION =		0
 DISTNAME =		ansible-${MODPY_EGG_VERSION}
 
 CATEGORIES =		sysutils
diff --git sysutils/ansible/patches/patch-ansible_collections_ansible_utils_plugins_plugin_utils_base_ipaddr_utils_py sysutils/ansible/patches/patch-ansible_collections_ansible_utils_plugins_plugin_utils_base_ipaddr_utils_py
new file mode 100644
index 00000000000..77756e1aa94
--- /dev/null
+++ sysutils/ansible/patches/patch-ansible_collections_ansible_utils_plugins_plugin_utils_base_ipaddr_utils_py
@@ -0,0 +1,22 @@
+'IPAddress' object has no attribute 'is_private' in netaddr >= 1.0.0
+Index: ansible_collections/ansible/utils/plugins/plugin_utils/base/ipaddr_utils.py
+--- ansible_collections/ansible/utils/plugins/plugin_utils/base/ipaddr_utils.py.orig
++++ ansible_collections/ansible/utils/plugins/plugin_utils/base/ipaddr_utils.py
+@@ -289,7 +289,7 @@ def _previous_usable_query(v, vtype):
+ 
+ 
+ def _private_query(v, value):
+-    if v.is_private():
++    if not v.is_global():
+         return value
+ 
+ 
+@@ -298,7 +298,7 @@ def _public_query(v, value):
+     if all(
+         [
+             v_ip.is_unicast(),
+-            not v_ip.is_private(),
++            v_ip.is_global(),
+             not v_ip.is_loopback(),
+             not v_ip.is_netmask(),
+             not v_ip.is_hostmask(),

-- 
In my defence, I have been left unsupervised.