From cf6e7610370aaa76220c36920ddee86342948cad Mon Sep 17 00:00:00 2001 From: IJAJ MULANI Date: Tue, 10 Sep 2024 22:03:48 +0530 Subject: [PATCH] Fixed ansible.utils.ipaddr('host/prefix') function if size of subnet is 1. If non CIDR IP is given to ansible.utils.ipaddr('host/prefix') function is not returning False value. e.g ``` "192.168.0.21" | ansible.utils.ipaddr('host/prefix') ``` Ideally above code should return False value. Hence corrected the behaviour. --- plugins/plugin_utils/base/ipaddr_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/plugin_utils/base/ipaddr_utils.py b/plugins/plugin_utils/base/ipaddr_utils.py index 15040d46..f161db61 100644 --- a/plugins/plugin_utils/base/ipaddr_utils.py +++ b/plugins/plugin_utils/base/ipaddr_utils.py @@ -100,7 +100,7 @@ def _ip_query(v): def _address_prefix_query(v): - if v.size > 2 and v.ip in (v.network, v.broadcast): + if v.ip in (v.network, v.broadcast): return False return str(v.ip) + "/" + str(v.prefixlen)