Bug 2101462
| Summary: | Unexpected templating type error - expected str instance, int found | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Rich Megginson <rmeggins> |
| Component: | ansible-core | Assignee: | Dimitri Savineau <dsavinea> |
| Status: | CLOSED ERRATA | QA Contact: | Matt Clay <mclay> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | medium | ||
| Version: | CentOS Stream | CC: | jwboyer |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | ansible-core-2.13.1-2.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-11-15 09:52:23 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: | |||
centos stream 9 MR was merged - merged into downstream rhel-9-main branch - waiting for internal build to finish 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 (ansible-core bug fix and enhancement update), 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-2022:7956 |
Description of problem: There is an issue using macros with ansible-core 2.13 and its bundled jinja 3.0.3. Running ansible-playbook -vv jinja30-error.yml with this playbook: - hosts: localhost gather_facts: false vars: mydict: a: a b: 1 tasks: - name: show error debug: msg: | {% macro doerror(key,value) %} {{ key }} {{ value }} {% endmacro %} {{ doerror('b', mydict['b']) }} Gives this error: Unexpected templating type error occurred on ({% macro doerror(key,value) %} {{ key }} {{ value }} {% endmacro %} {{ doerror('b', mydict['b']) }} ): sequence item 2: expected str instance, int found This does not have any errors when using jinja 2.x or jinja 3.1.x. You can fix this by using {{ value | string }}, but this seems like a bug in jinja 3.0.x since it works correctly without the "| string" on 2.x and 3.1.x Version-Release number of selected component (if applicable): ansible-core 2.13 with bundled jinja 3.0.3 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: