Skip to content

fix: use explicit bool instead of implicit truthy #619

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Spirit-act
Copy link
Contributor

Why

With Ansible 2.19 implicit truthy is no longer allowed and ansible errors.

Changes

This commit adds explicit checks which returns boolean.

Thoughts

For variables which are defined as:

_common_checksums_url: ""

I have add a check for length, because they count as defined.

Variables which are not clear, for example:

_common_dependencies

I have tested what they can be. In this example null or "python3-apt ".
(I have no idea why there is a space after ...-apt)

For some reason null counts as defined. I have checked it with _common_dependencies is defined

Sources

https://ansible.readthedocs.io/projects/ansible-core/devel/porting_guides/porting_guide_core_2.19.html#broken-conditionals

As described here: https://ansible.readthedocs.io/projects/ansible-core/devel/porting_guides/porting_guide_core_2.19.html#broken-conditionals

In Ansible greater than 2.19 implicit truthy is no longer allowed.
Therefor we need to use explicit checks.

Signed-off-by: Spirit-act <[email protected]>
@Spirit-act Spirit-act changed the title use explicit bool instead of implicit truthy fix: use explicit bool instead of implicit truthy Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant