New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jinja2 3.1 Breaks filter #77413
Comments
Files identified in the description: If these files are incorrect, please update the |
fixed in #75881, which applied it to 2.13 |
This actually looks more like a duplicate of #77406, #77383 and #77356.
This is expected, the versions of Ansible that this was fixed (#74666) in are
This should not be the case. Can you double check that you are indeed running needs_info |
@mkrizek Could you confirm it was fixed in 2.9.22? I've upgraded to this version and I'm still getting the same issue:
|
@xfyre For me it works - ---
- hosts: localhost
gather_facts: no
tasks:
- debug:
msg: "{{ 1 | pow(2) }}"
ansible --version
ansible 2.9.22
config file = None
configured module search path = ['/Users/akasurde/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Volumes/data/src/ansible/lib/ansible
executable location = /Volumes/data/src/ansible/bin/ansible
python version = 3.9.10 (main, Jan 15 2022, 11:48:00) [Clang 13.0.0 (clang-1300.0.29.3)] |
Yes.
Assuming the location from the provided output, what is the output of the following command?
|
@mkrizek Thanks for looking into this. I appears that, indeed, everything is working is expected, and my problem was related to the CodeShip "cache reset" feature not doing what it should (cached docker image with an old version somehow stuck and kept giving me the same error). My builds today are working with 2.9.22. |
Things are also working for me. The Docker image I was testing that originally led to this bug report was destroyed and I don't have a list of Python modules/versions that were installed outside of Thanks to all who spent time on this. |
Closing as per above. If you have further questions please stop by IRC or the mailing list:
|
Summary
Version 3.1 of Jinja2 removed deprecated code, including
environmentfilter
: pallets/jinja#1544Attempting to execute Ansible operations that use
filter
with Jinja2 >= 3.1 results in:This issue appears to have been originally addressed here: #74667
Issue Type
Bug Report
Component Name
filter
Ansible Version
Configuration
OS / Environment
Linux (EL7)
Python 3.10.4 compiled from source
Jinja2 3.1.1
Ansible 5.5.0 (according to
pip3 freeze
)Ansible Core 2.12.3 (according to
pip3 freeze
)Same results with Ansible 2.10.7 and Ansible Base 2.10.9 using Python 3.9.10.
Steps to Reproduce
Install Jinja2 version 3.1.x
Execute playbook
Expected Results
No Python import error
Actual Results
[WARNING]: Skipping plugin (/opt/python3/lib/python3.10/site-packages/ansible/plugins/filter/core.py) as it seems to be invalid: cannot import name 'environmentfilter' from 'jinja2.filters' (/opt/python3/lib/python3.10/site-packages/jinja2/filters.py)
Code of Conduct
The text was updated successfully, but these errors were encountered: