-
Notifications
You must be signed in to change notification settings - Fork 225
Ansible 12 compatibility (implicit boolean conversion) #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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