Ansible 12 compatibility (implicit boolean conversion) - #132
Conversation
|
Thanks a lot for this, I haven't upgraded to that version of Ansible yet. Most of the changes are things like this What happens when I don't have a system to test this on. If it's a problem, maybe we should be explicit and use |
|
Another thing to consider is the docs mention If both work, there is a readability consideration here. The docs themselves use With that said, we are dealing with a I'm just writing this out so it's documented. I'm not sure which option to pick yet. Do you have any considerations? |
ea99a75 to
aeac254
Compare
|
@nickjj Thanks for the quick response + suggestions!
WDYT? |
|
Thanks. Let me think about it for a day or 2, but we'll merge one of them! |
aeac254 to
090e261
Compare
|
Looks good, do you want to roll this up to 1 commit? We can go with the |
Replace 'when: var | d()' with 'when: (var | d("")) | is truthy'
for string variables.
Fixes 'Conditionals must have a boolean result' error in
Ansible 12.
See https://docs.ansible.com/ansible/latest/porting_guides/
porting_guide_12.html#example-implicit-boolean-conversion
090e261 to
027cacd
Compare
|
All rolled up. |
|
Thanks a lot for this! I just released v2.5.2 which has this available. |
This PR fixes compatibility issues with Ansible 12 by updating conditional statements to use proper boolean evaluation. It fixes "Conditionals must have a boolean result" error.
Changes:
when: var | d()towhen: (var | d("")) | is truthyfor string variablesSee https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_12.html#example-implicit-boolean-conversion