Skip to content

Commit

Permalink
Fix exception with 'skipped' test (#4406)
Browse files Browse the repository at this point in the history
Co-authored-by: MARGERIE Gilles <[email protected]>
  • Loading branch information
Gilles95 and MARGERIE Gilles authored Nov 20, 2024
1 parent d58af09 commit d06911b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/playbooks/rule-jinja-pass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,18 @@
- name: Bug https://github.com/ansible/ansible-lint/issues/3908
ansible.builtin.debug:
msg: "{{ foo | ansible.builtin.mandatory(msg='My message') }}"

- name: Bugs https://github.com/ansible/ansible-lint/issues/4338
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 }}!"
2 changes: 2 additions & 0 deletions src/ansiblelint/rules/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class Token(NamedTuple):
r"Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for (.*) filter <value>$",
# https://github.com/ansible/ansible-lint/issues/3155
r"^The '(.*)' test expects a dictionary$",
# https://github.com/ansible/ansible-lint/issues/4338
r"An unhandled exception occurred while templating (.*). Error was a <class 'ansible.errors.AnsibleFilterError'>, original message: The (.*) test expects a dictionary$",
],
),
flags=re.MULTILINE | re.DOTALL,
Expand Down

0 comments on commit d06911b

Please sign in to comment.