-
Notifications
You must be signed in to change notification settings - Fork 84
fix: ansible truthy handling #308
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
base: main
Are you sure you want to change the base?
Conversation
@ssbarnea can you take a look at this PR? |
Co-authored-by: Evgeni Golov <evgeni@golov.de>
Co-authored-by: Evgeni Golov <evgeni@golov.de>
@@ -13,7 +13,7 @@ | |||
- name: Set async_dir for HOME env | |||
ansible.builtin.set_fact: | |||
ansible_async_dir: "{{ lookup('env', 'HOME') }}/.ansible_async/" | |||
when: (lookup('env', 'HOME')) | |||
when: lookup('env', 'HOME') is truthy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it more correct to check the string length? something like
when: lookup('env', 'HOME') is truthy | |
when: lookup('env', 'HOME') | length > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably also applies to the other checks that do strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's a matter of personal preference... I like is truthy
little bit more because it checks if it's defined and not 0
, empty
, null
etc.
But I'm not the one who decides :)
Co-authored-by: Evgeni Golov <evgeni@golov.de>
Co-authored-by: Evgeni Golov <evgeni@golov.de>
With the new Ansible version 2.19, something changes in handling with true/false values, which is why the molecule tests fail.
https://github.com/ansible-collections/community.grafana/actions/runs/14622246579/job/41025024595?pr=419
Fixes #311