Skip to content

Commit

Permalink
Avoid 'not defined' with jinja rule
Browse files Browse the repository at this point in the history
Fixes: #3048
  • Loading branch information
ssbarnea committed Feb 17, 2023
1 parent f74825c commit 759f821
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/playbooks/rule-jinja-valid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@
test:
one: two
param: no jinja

- name: Bug https://github.com/ansible/ansible-lint/issues/3048
hosts: localhost
tasks:
- name: "Test for bug #3048"
ansible.builtin.debug:
msg: "{{ __my_var | mandatory }}"
loop: "{{ a_var }}"
loop_control:
loop_var: __my_var
vars:
a_var:
- one
1 change: 1 addition & 0 deletions src/ansiblelint/rules/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
r"could not locate file in lookup",
r"unable to locate collection",
r"^Error in (.*)is undefined$",
r"^Mandatory variable (.*) not defined.$",
]
),
flags=re.MULTILINE | re.DOTALL,
Expand Down

0 comments on commit 759f821

Please sign in to comment.