From dae8941863f233f6b5f0300fb523b41158f19b95 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 7 Mar 2023 14:40:18 +0000 Subject: [PATCH] Avoid 'Unrecognized type' errors with jinja rule (#3149) --- .config/dictionary.txt | 1 + examples/playbooks/rule-jinja-pass.yml | 8 ++++++-- src/ansiblelint/rules/jinja.py | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.config/dictionary.txt b/.config/dictionary.txt index 157c54315f..898c56b8f4 100644 --- a/.config/dictionary.txt +++ b/.config/dictionary.txt @@ -159,6 +159,7 @@ importlib iniconfig inlinehilite insertafter +ipaddr ipwrap isclass iscsi diff --git a/examples/playbooks/rule-jinja-pass.yml b/examples/playbooks/rule-jinja-pass.yml index dc6274eb65..0a604b7f10 100644 --- a/examples/playbooks/rule-jinja-pass.yml +++ b/examples/playbooks/rule-jinja-pass.yml @@ -63,13 +63,17 @@ a_var: - one -- name: Bug https://github.com/ansible/ansible-lint/issues/3082 +- name: Bugs hosts: localhost tasks: - - name: Use with_items to populate a file + - name: Bug https://github.com/ansible/ansible-lint/issues/3082 ansible.builtin.copy: content: "{{ item.cfg | to_nice_yaml(indent=2, width=9999) }}" dest: "/tmp/{{ item.name }}.yaml" mode: "0640" with_items: - name: file2 + + - name: Bug https://github.com/ansible/ansible-lint/issues/3136 + ansible.builtin.debug: + msg: "IP is {{ foo | ansible.utils.ipaddr('address') }}" diff --git a/src/ansiblelint/rules/jinja.py b/src/ansiblelint/rules/jinja.py index 11d32bac3e..b6e1f13de5 100644 --- a/src/ansiblelint/rules/jinja.py +++ b/src/ansiblelint/rules/jinja.py @@ -42,6 +42,7 @@ r"^Error in (.*)is undefined$", r"^Mandatory variable (.*) not defined.$", r"is undefined", + r"Unrecognized type <> for (.*) filter $", ] ), flags=re.MULTILINE | re.DOTALL,