galaxyproject / ansible-galaxy

An Ansible role for managing a Galaxy server
https://galaxy.ansible.com/galaxyproject/galaxy
58 stars 75 forks source link

Fix issue with jinja2 < 2.11.0 #193

Closed nsoranzo closed 1 year ago

nsoranzo commented 1 year ago

Ubuntu 20.04 LTS has jinja2 2.10.1, which doesn't support is true and various other is tests added in https://github.com/pallets/jinja/pull/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.

hexylena commented 1 year ago

20.04 is quite old, hmm.

nsoranzo commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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