Skip to content

Commit

Permalink
Fixed ansible.utils.ipaddr('host/prefix') function if size of subnet …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ijajmulani authored Sep 10, 2024
1 parent c4ace98 commit cf6e761
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/plugin_utils/base/ipaddr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit cf6e761

Please sign in to comment.