You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
if isinstance(value, (int, str)) and value:
# proceed with filtering
pass
else:
return False
TASK [ipaddr per item] *********************************************************
ok: [localhost] => (item=127.0.0.1) => {
"msg": "127.0.0.1 => 127.0.0.1"
}
ok: [localhost] => (item=192.168.0.0/24) => {
"msg": "192.168.0.0/24 => 192.168.0.0/24"
}
ok: [localhost] => (item=192.168.0.14/24) => {
"msg": "192.168.0.14/24 => 192.168.0.14/24"
}
ok: [localhost] => (item=8.8.8.8) => {
"msg": "8.8.8.8 => 8.8.8.8"
}
ok: [localhost] => (item=8.8.8.0/27) => {
"msg": "8.8.8.0/27 => 8.8.8.0/27"
}
[WARNING]: The value '' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
ok: [localhost] => (item=) => {
"msg": " => False"
}
ok: [localhost] => (item=some string) => {
"msg": "some string => False"
}
ok: [localhost] => (item=[]) => {
"msg": "[] => []"
}
[WARNING]: The value 'True' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
ok: [localhost] => (item=True) => {
"msg": "True => False"
}
[WARNING]: The value 'False' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
ok: [localhost] => (item=False) => {
"msg": "False => False"
}
[WARNING]: The value '0' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
ok: [localhost] => (item=0) => {
"msg": "0 => False"
}
ok: [localhost] => (item=[1, 2]) => {
"msg": "[1, 2] => ['0.0.0.1', '0.0.0.2']"
}
ok: [localhost] => (item=1) => {
"msg": "1 => 0.0.0.1"
}
TASK [ipaddr on list] **********************************************************
[WARNING]: The value '' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
[WARNING]: The value 'True' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
[WARNING]: The value 'False' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
[WARNING]: The value '0' is not a valid IP address or network, passing this
value to ipaddr filter might result in breaking change in future.
ok: [localhost] => {
"msg": [
"127.0.0.1",
"192.168.0.0/24",
"192.168.0.14/24",
"8.8.8.8",
"8.8.8.0/27",
[
"0.0.0.1",
"0.0.0.2"
],
"0.0.0.1"
]
}
If float or dict values are uncommented, it results in error.
fatal: [localhost]: FAILED! => {"msg": "Unrecognized type <<class 'float'>> for ipaddr filter <value>"}
fatal: [localhost]: FAILED! => {"msg": "Unrecognized type <<class 'dict'>> for ipaddr filter <value>"}
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: