Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with jinja2 < 2.11.0 #193

Merged
merged 1 commit into from
Apr 19, 2023
Merged

Fix issue with jinja2 < 2.11.0 #193

merged 1 commit into from
Apr 19, 2023

Conversation

nsoranzo
Copy link
Member

Ubuntu 20.04 LTS has jinja2 2.10.1, which doesn't support is true and various other is tests added in pallets/jinja#824

Fix:

TASK [galaxyproject.galaxy : Schedule tmpclean cron job (root)] *******************************************************************************************************************************************
fatal: [gat-18.eu.galaxy.training]: FAILED! => 
  msg: |-
    An unhandled exception occurred while templating '{{ (galaxy_tmpclean_log is not true) | ternary(
        ((galaxy_tmpclean_log is none) | ternary(
            '>/dev/null',
            '>>' ~ galaxy_tmpclean_log
        )),
        ''
    ) }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: no test named 'true'. String: {{ (galaxy_tmpclean_log is not true) | ternary(
        ((galaxy_tmpclean_log is none) | ternary(
            '>/dev/null',
            '>>' ~ galaxy_tmpclean_log
        )),
        ''
    ) }}

when using ansible 2.12.10 .

Alternatively we could make clear that jinja >= 2.11.0 is required.

Ubuntu 20.04 LTS has jinja2 2.10.1, which doesn't support `is true` and various other `is` tests added in pallets/jinja#824

Fix:
```
TASK [galaxyproject.galaxy : Schedule tmpclean cron job (root)] *******************************************************************************************************************************************
fatal: [gat-18.eu.galaxy.training]: FAILED! => 
  msg: |-
    An unhandled exception occurred while templating '{{ (galaxy_tmpclean_log is not true) | ternary(
        ((galaxy_tmpclean_log is none) | ternary(
            '>/dev/null',
            '>>' ~ galaxy_tmpclean_log
        )),
        ''
    ) }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: no test named 'true'. String: {{ (galaxy_tmpclean_log is not true) | ternary(
        ((galaxy_tmpclean_log is none) | ternary(
            '>/dev/null',
            '>>' ~ galaxy_tmpclean_log
        )),
        ''
    ) }}
```
@hexylena
Copy link
Member

20.04 is quite old, hmm.

@nsoranzo
Copy link
Member Author

20.04 is quite old, hmm.

It has EOL 2030... I'd have updated my laptop to 22.04 but it's due for replacement :D

For context, the latest ansible requires jinja2 >=3.0, but for the ansible version this role requires the jinjia2 requirement is unpinned.

@natefoo
Copy link
Member

natefoo commented Apr 18, 2023

To be clear, this is with Ansible installed from apt on 20.04? Ansible itself appears to require unpinned jinja2, so if you pip install 'ansible-core<2.13' I think you'd get a version of jinja2 that supported this.

I am not sure when foo == true syntax will be dropped but IIRC it warns already.

@nsoranzo
Copy link
Member Author

No, it's a deb package from https://launchpad.net/~ansible/+archive/ubuntu/ansible .

Copy link
Member

@natefoo natefoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to have been wrong about it warning... and the != syntax for booleans is not deprecated?

@natefoo natefoo merged commit b12ea40 into main Apr 19, 2023
@nsoranzo nsoranzo deleted the nsoranzo-patch-1 branch April 19, 2023 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants