Skip to content

Commit

Permalink
Fix #4338
Browse files Browse the repository at this point in the history
  • Loading branch information
MARGERIE Gilles committed Nov 15, 2024
1 parent 2e5af42 commit edde23a
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 edde23a

Please sign in to comment.