Bug 2086141

Summary: Update python38-jinja2 to 2.11.x
Product: Red Hat Enterprise Linux 8 Reporter: Maxwell G <maxwell>
Component: python-jinja2Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: ---CC: lbalhar, pviktori, python-maint, rhel-cs-apps-subsystem-qe, torsava
Target Milestone: rcKeywords: Rebase, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python38-3.8-8070020220607122956.bd194b04 python-jinja2-2.11.3-1.module+el8.7.0+15575+d005caff Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 09:44:15 UTC Type: Component Upgrade
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[PATCH] Update to 2.11.3. Fixes rhbz#2086141.
none
Reproducer playbook
none
[PATCH] Backport missing jinja2 tests needed by ansible-core (rhbz#2086141). none

Description Maxwell G 2022-05-14 04:17:11 UTC
Description of problem:

Please update python3-jinja2 and python38-jinja2 to at least 2.11.x.

Comment 1 Maxwell G 2022-05-14 04:24:13 UTC
I am not sure if I did something wrong, but it appears nobody was added to the CC list.

Comment 3 Tomas Orsava 2022-05-18 12:12:48 UTC
Hi Maxwell,
what's the use case you need these updates for?

And if you'd like us to prioritize this properly, consider filing a customer case for this request.

Comment 4 Maxwell G 2022-05-18 16:14:31 UTC
Hi Tomas,

(In reply to Tomas Orsava from comment #3)
> what's the use case you need these updates for?

There is certain functionality in ansible-core that does not work without a newer version of jinja2. Only the python38 version really needs to be updated for my usecase. I suppose ansible 2.9 which is still in the Ansible Engine channel could also make use of the python36 version.

Comment 5 Maxwell G 2022-05-22 04:31:39 UTC
Created attachment 1881999 [details]
[PATCH] Update to 2.11.3. Fixes rhbz#2086141.

I wrote this patch against the c8s-stream-3.8 branch[1]. It can be applied to RHEL dist-git with "git am -p2". FWIW, this is the same version that's currently in c9s. I have confirmed that it fixes my issue.

[1]: https://git.centos.org/rpms/python-jinja2/tree/c8s-stream-3.8

Comment 6 Tomas Orsava 2022-05-23 09:28:08 UTC
Interesting, and thanks for the patch. Can you expand on what ansible-core functionality does not work without a newer version of jinja2?

Comment 7 Maxwell G 2022-05-24 02:35:36 UTC
Created attachment 1882537 [details]
Reproducer playbook

I have attached a (slightly contrived) reproducer Ansible playbook. These type of assert tasks are more commonly used to verify user modifiable variables in a role. Basically, the problem comes down to the missing boolean, integer, and float jinja2 tests.

With ansible-core and python38-jinja2-2.10.3-5.module+el8.5.0+10542+ba057329.noarch on RHEL 8:

```
$ ./missing_jinja_tests.yml

PLAY [missing_jinja_tests] *****************************************************************************************

TASK [ansible.builtin.assert] **************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'test_boolean is boolean' failed. The error was: template error while templating string: no test named 'boolean'. String: {% if test_boolean is boolean %} True {% else %} False {% endif %}"}
...ignoring

TASK [ansible.builtin.assert] **************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'test_int is integer' failed. The error was: template error while templating string: no test named 'integer'. String: {% if test_int is integer %} True {% else %} False {% endif %}"}
...ignoring

TASK [ansible.builtin.assert] **************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'test_float is float' failed. The error was: template error while templating string: no test named 'float'. String: {% if test_float is float %} True {% else %} False {% endif %}"}
...ignoring

PLAY RECAP *********************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=3
```

With ansible-core and `python38-jinja2-2.11.3-1.el8.noarch` (my patch built against python38 with `--define "python3_pkgversion 38"`):

```
PLAY [missing_jinja_tests] *****************************************************************************************

TASK [ansible.builtin.assert] **************************************************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [ansible.builtin.assert] **************************************************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [ansible.builtin.assert] **************************************************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

PLAY RECAP *********************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
```

Comment 8 Miro Hrončok 2022-05-24 09:58:22 UTC
So, technically, backporting https://github.com/pallets/jinja/pull/824 would fix this for you?

Comment 9 Maxwell G 2022-05-24 14:36:49 UTC
(In reply to Miro Hrončok from comment #8)
> So, technically, backporting https://github.com/pallets/jinja/pull/824 would
> fix this for you?

Yes, that should work. I forgot that was an option.

Comment 10 Maxwell G 2022-05-25 01:50:25 UTC
Created attachment 1883003 [details]
[PATCH] Backport missing jinja2 tests needed by ansible-core (rhbz#2086141).

A complete update would be preferable, but I suppose just backporting the missing tests would suffice if the former is not unpermissible. I have confirmed that this patch also fixes my issue.

Comment 11 Maxwell G 2022-05-25 02:01:06 UTC
> not unpermissible
s/not unpermissible/unpermissible/

Comment 12 Tomas Orsava 2022-06-01 12:25:06 UTC
We can rebase python38-jinja2 as it's in a module and there the rebase policy is less strict. For python3-jinja2 we would only consider a backport, but since the reporter explicitly says a fix for python3-jinja2 is not needed for their use case hence we won't be backporting the fix at this point. We'll do a rebase of the python38-jinja2.

Comment 13 Maxwell G 2022-06-01 14:10:30 UTC
Thank you, Tomas! I've changed the Bugzilla summary accordingly.

Comment 19 errata-xmlrpc 2022-11-08 09:44:15 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 (Moderate: python38:3.8 and python38-devel:3.8 security 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/RHSA-2022:7581