MSYS2-packages
MSYS2-packages copied to clipboard
ansible incompatible to python-jinja 3.1
Description
In python-jinja
3.1, the environmentfilter
decorator got renamed to pass_environment
, which is not taken into account in the two files core.py
and mathstuff.py
in the /usr/lib/python3.10/site-packages/ansible/plugins/filter
directory. Fixes I can think of:
- either search&replace all instances of
environmentfilter
withpass_environment
- or change only the import lines in those files to something like
from jinja2.filters import pass_environment as environmentfilter
Verification
- [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)
Windows Version
Microsoft Windows [Version 10.0.19044.1889]
Expected behavior
PLAY [Demo] ******************************************************************************************************
TASK [Saying hello] **********************************************************************************************
ok: [localhost] => {
"msg": "Hello World"
}
PLAY RECAP *******************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Actual behavior
PLAY [Demo] ******************************************************************************************************
TASK [Saying hello] **********************************************************************************************
[WARNING]: Skipping plugin (/usr/lib/python3.10/site-packages/ansible/plugins/filter/core.py) as it seems to be invalid: cannot import name 'environmentfilter' from 'jinja2.filters' (/usr/lib/python3.10/site-packages/jinja2/filters.py)
[WARNING]: Skipping plugin (/usr/lib/python3.10/site-packages/ansible/plugins/filter/mathstuff.py) as it seems to be invalid: cannot import name 'environmentfilter' from 'jinja2.filters' (/usr/lib/python3.10/site-packages/jinja2/filters.py)
ok: [localhost] => {
"msg": "Hello World"
}
PLAY RECAP *******************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Repro steps
$ cat <<EOF >demo.yml
- name: Demo
hosts: localhost
connection: local
gather_facts: false
vars:
greetee: World
tasks:
- name: Saying hello
debug:
msg: 'Hello {{ greetee }}'
EOF
$ ansible-playbook -i localhost, test.yml
Are you willing to submit a PR?
No response
Just checked:
-
Jinja 3.1.0 with the removal of
environmentfilter
was released 2022-03-24 - Ansible 2.9.27 is the latest version on the release-server used by the current ansible PKGBUILD, and it was released 2021-10-11
- that Ansible version is no longer maintained
- as mentioned on the release-server, newer packages can be found on PyPI
So an update to a newer Ansible version is not as simple as bumping the version number and updating the checksum.
thanks. we should update ansible (likely needs quite a few new packages :/)
Is it possible to move ansible package to mingw?
I am running ansible under an msys shell and using things like when: ansible_os_family is match("MSYS_NT-")
in my playbooks to detect if this is an MSYS2 environment or not. If this gets moved to mingw, then I need to update the MSYS2 detection: is there something more stable to detect MSYS2 independent of the specific shell that ansible is run under?
Just checked:
- Jinja 3.1.0 with the removal of
environmentfilter
was released 2022-03-24- Ansible 2.9.27 is the latest version on the release-server used by the current ansible PKGBUILD, and it was released 2021-10-11
- that Ansible version is no longer maintained
- as mentioned on the release-server, newer packages can be found on PyPI
So an update to a newer Ansible version is not as simple as bumping the version number and updating the checksum.
Subscribed. Thank you @olafmandel, don't use Windows that often anymore, will set a clean MSYS env, try to replicate the behavior, updating Ansible major version and the Python dependencies should fix this issue
Is it possible to move ansible package to mingw?
I guess no: https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html#can-ansible-run-on-windows
No, Ansible can only manage Windows hosts. Ansible cannot run on a Windows host natively, though it can run under the Windows Subsystem for Linux (WSL).
I'm working on this
- [ ] Update dependencies
- [ ] Migrate
ansible
toansible-core