ansible-role-interfaces icon indicating copy to clipboard operation
ansible-role-interfaces copied to clipboard

Newer version of jinja2 breaks the role

Open layereight opened this issue 2 years ago • 3 comments

tested with:

  • latest role version 1.13.1
  • python 3.10
  • jinja2 3.1.2
  • will fail with:
TASK [MichaelRigart.interfaces : Check active Ethernet interface state] ************
[WARNING]: Skipping plugin (/home/stefan/private/ansible-
homecenter/roles/MichaelRigart.interfaces/filter_plugins/filters.py) as it seems to
be invalid: module 'jinja2' has no attribute 'contextfilter'
fatal: [homecenter]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ item | ether_check }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: No filter named 'ether_check'.. String: {{ item | ether_check }}"}

tested workaround:

  • going back to jinja 3.0.3 fixes the problem

I haven't checked which jinja2 version update really introduces the breaking change...

layereight avatar Jun 01 '22 14:06 layereight

contextfilter is deprecated in jinja2 and can be replaced by pass_context https://github.com/jupyter/nbconvert/issues/1568

YuxingW avatar Jun 24 '22 22:06 YuxingW

We have checked in a fix for this issue in the latest code.

YuxingW avatar Jun 28 '22 16:06 YuxingW

Cool! Will check on the next occasion.

layereight avatar Jul 07 '22 14:07 layereight