Open Vladimir-csp opened 1 year ago
Another inconsistency: 1 => 0.0.0.1
but 0 => False
. Could be 0 => 0.0.0.0
Probably related, I think this used to work(or maybe I had just not tested it appropriately), but doesn't appear to work on ansible.utils 3.1.0
task:
- name: debug range
debug:
msg: "{{ '10.151.120.0' | ansible.utils.ipaddr('10.152.120.0/22') }}"
Expected:
TASK [hamstring.linux.netchecks : debug range] ************************************************************************************************************
task path: /home/hamstring/.ansible/collections/ansible_collections/hamstring/linux/roles/netchecks/tasks/preflight.yml:9
ok: [testbed.home.arpa] => {
"msg": "false"
}
Actual:
TASK [hamstring.linux.netchecks : debug range] ************************************************************************************************************
task path: /home/hamstring/.ansible/collections/ansible_collections/hamstring/linux/roles/netchecks/tasks/preflight.yml:9
ok: [testbed.home.arpa] => {
"msg": ""
}
SUMMARY
Hi. If the point of ipaddr filters is to parse/modify valid values and return
False
(or discard in lists) for invalid, then why some invalid values produce warnings (and even errors)? The doc contains''
example which is shown to be discarded silently, but in actuality produces a warning.Chaining multiple ipaddr family and other filters becomes hard as one needs to take care to manually filter out anything that might break it, instead of just relying on ipaddr filter to parse what is parseable. Even chaining two ipaddr filters together will result in warning if the value does not pass through the first because
False
is now invalid.This behavior was introduced at some point, but why? and what is the plan for "breaking change in future"?
Just placing this before singular values in ipaddr filters could simplify a lot of stuff:
ISSUE TYPE
COMPONENT NAME
ipaddr
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Debian testing
STEPS TO REPRODUCE
EXPECTED RESULTS
Everything invalid is silently discarded, ints and valid stings are parsed
ACTUAL RESULTS
If float or dict values are uncommented, it results in error.