Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Nemental
Copy link

@Nemental Nemental commented Apr 23, 2025

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

  TASK [Set async_dir for HOME env] **********************************************
  [ERROR]: Task failed: Conditional result was '/home/runner' of type 'str', which evaluates to True. Conditionals must have a boolean result.
  
  Task failed.
  Origin: /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/molecule_plugins/docker/playbooks/destroy.yml:10:7
  
   8     - always
   9   tasks:
  10     - name: Set async_dir for HOME env
           ^ column 7
  
  <<< caused by >>>
  
  Conditional result was '/home/runner' of type 'str', which evaluates to True. Conditionals must have a boolean result.
  Origin: /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/molecule_plugins/docker/playbooks/destroy.yml:13:13
  
  11       ansible.builtin.set_fact:
  12         ansible_async_dir: "{{ lookup('env', 'HOME') }}/.ansible_async/"
  13       when: (lookup('env', 'HOME'))
                 ^ column 13
  
  Broken conditionals can be temporarily allowed with the `ALLOW_BROKEN_CONDITIONALS` configuration option.
  
  fatal: [localhost]: FAILED! => {"changed": false, "msg": "Task failed: Conditional result was '/home/runner' of type 'str', which evaluates to True. Conditionals must have a boolean result."}

Fixes #311

@felixfontein
Copy link

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility with ansible-core 2.19
4 participants