Skip to content

Commit edde23a

Browse files
author
MARGERIE Gilles
committed
Fix #4338
1 parent 2e5af42 commit edde23a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

examples/playbooks/rule-jinja-pass.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,18 @@
8888
- name: Bug https://github.com/ansible/ansible-lint/issues/3908
8989
ansible.builtin.debug:
9090
msg: "{{ foo | ansible.builtin.mandatory(msg='My message') }}"
91+
92+
- name: Bugs https://github.com/ansible/ansible-lint/issues/4338
93+
hosts: localhost
94+
tasks:
95+
- name: Test task
96+
ansible.builtin.debug:
97+
msg: "Hello, world!"
98+
when: false
99+
register: result
100+
101+
- name: Test task 2
102+
vars:
103+
counter: "{{ result is skipped | ternary(1, 2) }}"
104+
ansible.builtin.debug:
105+
msg: "Hello, world {{ counter }}!"

src/ansiblelint/rules/jinja.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class Token(NamedTuple):
6565
r"Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for (.*) filter <value>$",
6666
# https://github.com/ansible/ansible-lint/issues/3155
6767
r"^The '(.*)' test expects a dictionary$",
68+
# https://github.com/ansible/ansible-lint/issues/4338
69+
r"An unhandled exception occurred while templating (.*). Error was a <class 'ansible.errors.AnsibleFilterError'>, original message: The (.*) test expects a dictionary$",
6870
],
6971
),
7072
flags=re.MULTILINE | re.DOTALL,

0 commit comments

Comments
 (0)