Bug 1697237
Summary: | Jinja2 templating breaks with "<lambda>() takes exactly 0 arguments (1 given)" in Ansible | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Till Maas <till> |
Component: | python-jinja2 | Assignee: | Python Maintainers <python-maint> |
Status: | CLOSED ERRATA | QA Contact: | Lukáš Zachar <lzachar> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.7 | CC: | cstratak, hhorak, jkejda, mhroncok, pviktori |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | python-jinja2-2.7.2-3.el7 | Doc Type: | No Doc Update |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-08-06 13:17:46 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Till Maas
2019-04-08 07:28:12 UTC
Minimal example using Ansible: cat > 'dict_test.yml' <<EOF --- - hosts: localhost vars: dict_test: "{{ dict([(0, 1)]) }}" tasks: - name: Show dict debug: var: dict_test EOF Test run on RHEL 7.6: ansible-playbook ~/dict_test.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ********************************************************************************************************************** TASK [Gathering Facts] **************************************************************************************************************** ok: [localhost] TASK [Show dict] ********************************************************************************************************************** fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ dict([(0, 1)]) }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Unexpected templating type error occurred on ({{ dict([(0, 1)]) }}): <lambda>() takes exactly 0 arguments (1 given)"} to retry, use: --limit @/root/dict_test.retry PLAY RECAP **************************************************************************************************************************** localhost : ok=1 changed=0 unreachable=0 failed=1 ==================================================== It works on Fedora 28: ansible-playbook dict_test.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ***************************************************************************************************************************************************************************************** TASK [Gathering Facts] *********************************************************************************************************************************************************************************** ok: [localhost] TASK [Show dict] ***************************************************************************************************************************************************************************************** ok: [localhost] => { "dict_test": { "0": 1 } } PLAY RECAP *********************************************************************************************************************************************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=0 FWIW this started working in Jinja2 2.8 upstream. Nothing interesting in the chnagelog: http://jinja.pocoo.org/docs/2.10/changelog/#version-2-8 (In reply to Miro Hrončok from comment #4) > Upstream fix: > https://github.com/pallets/jinja/commit/ > 6179c02c91800d220de03006117afa5e6d60f0f6 Awesome, this simple fix makes it work! I patched it on my test VM and now the playbooks work again. Would be great to get this shipped! I'll send a Pagure PR, but somebody else from the team needs to take it from there. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:2313 |