[Pkg-salt-team] Bug#1033808: ImportError: cannot import name 'Markup' from 'jinja2'

supersonic supersonic112 at live.de
Sat Aug 5 19:55:24 BST 2023


Hi there,

this bug currently also prevents the salt-minion service (and possibly 
salt-master) from starting on Debian 12. The patch below to the file 
`/usr/lib/python3/dist-packages/salt/utils/jinja.py` allows the salt-minion to 
run and for its basic functions to work again. These Changes are already 
upstream in Salt v3004.2 (Debian 12 has v3004.1), see 
https://github.com/saltstack/salt/blob/v3004.2/salt/utils/jinja.py#L37  and 
https://github.com/saltstack/salt/blob/v3004.2/salt/utils/jinja.py#L715 .

I don't know if that's all, so I'll be testing for the next couple of weeks to 
see if any further things are broken during regular operation, but the basic 
functions I tested with the patch below all worked, so the patch could probably 
still be applied to restore basic functionality.


```
28c28
< from jinja2 import BaseLoader, Markup, TemplateNotFound, nodes
---
 > from jinja2 import BaseLoader, TemplateNotFound, nodes
36a37,42
 > try:
 >     from markupsafe import Markup
 > except ImportError:
 >     # jinja < 3.1
 >     from jinja2 import Markup  # pylint: disable=no-name-in-module
 >
707a714,717
 > try:
 >     contextfunction = jinja2.contextfunction
 > except AttributeError:
 >     contextfunction = jinja2.pass_context
709c719
< @jinja2.contextfunction
---
 > @contextfunction
```


I don't know if I will find the time to become an official Debian contributor 
right now, so if anybody else can apply the patch, feel free to do so.


Best regards
Supersonic



More information about the pkg-salt-team mailing list