Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2101462

Summary: Unexpected templating type error - expected str instance, int found
Product: Red Hat Enterprise Linux 9 Reporter: Rich Megginson <rmeggins>
Component: ansible-coreAssignee: Dimitri Savineau <dsavinea>
Status: CLOSED ERRATA QA Contact: Matt Clay <mclay>
Severity: unspecified Docs Contact:
Priority: medium    
Version: CentOS StreamCC: jwboyer
Target Milestone: rcKeywords: 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:

Description Rich Megginson 2022-06-27 14:40:40 UTC
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:

Comment 1 Rich Megginson 2022-06-27 17:11:17 UTC
centos stream 9 MR was merged - merged into downstream rhel-9-main branch - waiting for internal build to finish

Comment 7 errata-xmlrpc 2022-11-15 09:52:23 UTC
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