Skip to content
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

The 'skipped' test expects a dictionary for task specific vars #4338

Open
twouters opened this issue Sep 19, 2024 · 0 comments
Open

The 'skipped' test expects a dictionary for task specific vars #4338

twouters opened this issue Sep 19, 2024 · 0 comments
Labels
bug new Triage required

Comments

@twouters
Copy link

twouters commented Sep 19, 2024

This is similar to #3155

Summary

ansible-lint reports a syntax error for the skipped test when used in task specific vars

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint 24.9.1.dev0 using ansible-core:2.17.4 ansible-compat:24.9.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
STEPS TO REPRODUCE
---

- name: Test play
  hosts: localhost
  tasks:
    - name: Test task
      ansible.builtin.debug:
        msg: "Hello, world!"
      when: false
      register: result

    - name: Test task 2
      vars:
        counter: "{{ result is skipped | ternary(1, 2) }}"
      ansible.builtin.debug:
        msg: "Hello, world {{ counter }}!"
Desired Behavior
$ ansible-lint /tmp/main.yml

Passed: 0 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'production'.
Actual Behavior
$ ansible-lint /tmp/main.yml
WARNING  Listing 1 violation(s) that are fatal
jinja[invalid]: An unhandled exception occurred while templating '{{ result is skipped | ternary(1, 2) }}'. Error was a <class 'ansible.errors.AnsibleFilterError'>, original message: The 'skipped' test expects a dictionary
/tmp/main.yml:16 Task/Handler: Test task 2

Read documentation for instructions on how to ignore specific rule violations.

              Rule Violation Summary               
 count tag            profile rule associated tags 
     1 jinja[invalid] basic   formatting           

Failed: 1 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'min'.
@twouters twouters added bug new Triage required labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug new Triage required
Projects
Status: No status
Development

No branches or pull requests

1 participant