Skip to content

Commit dae8941

Browse files
authored
Avoid 'Unrecognized type' errors with jinja rule (#3149)
1 parent cef6c1e commit dae8941

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.config/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ importlib
159159
iniconfig
160160
inlinehilite
161161
insertafter
162+
ipaddr
162163
ipwrap
163164
isclass
164165
iscsi

examples/playbooks/rule-jinja-pass.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@
6363
a_var:
6464
- one
6565

66-
- name: Bug https://github.com/ansible/ansible-lint/issues/3082
66+
- name: Bugs
6767
hosts: localhost
6868
tasks:
69-
- name: Use with_items to populate a file
69+
- name: Bug https://github.com/ansible/ansible-lint/issues/3082
7070
ansible.builtin.copy:
7171
content: "{{ item.cfg | to_nice_yaml(indent=2, width=9999) }}"
7272
dest: "/tmp/{{ item.name }}.yaml"
7373
mode: "0640"
7474
with_items:
7575
- name: file2
76+
77+
- name: Bug https://github.com/ansible/ansible-lint/issues/3136
78+
ansible.builtin.debug:
79+
msg: "IP is {{ foo | ansible.utils.ipaddr('address') }}"

src/ansiblelint/rules/jinja.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
r"^Error in (.*)is undefined$",
4343
r"^Mandatory variable (.*) not defined.$",
4444
r"is undefined",
45+
r"Unrecognized type <<class 'ansible.template.AnsibleUndefined'>> for (.*) filter <value>$",
4546
]
4647
),
4748
flags=re.MULTILINE | re.DOTALL,

0 commit comments

Comments
 (0)