Salt: Jinja Error in templates but NOT dom0!?

2 views
Skip to first unread message

Johannes Graumann

unread,
May 3, 2022, 5:01:20 AM5/3/22
to qubes...@googlegroups.com
I have the following `*.sls` in my `salt`setup:

{% if salt['pkg.version_cmp'](salt['grains'].get('kernelrealease'), '5.12') < 0 %}
move broken AX260 wifi blob out of the way:
  file.rename:
    - name: /usr/lib/firmware/iwlwifi-ty-a0-gf-ao.pnvm.xz.bak
    - source: /usr/lib/firmware/iwlwifi-ty-a0-gf-ao.pnvm.xz
    - force: True
    - runas: root
{% endif %}

This is supposed to automate moving `linux` firmware out of the way that interferes with my wifi card's operation under certain non-cutting edge kernel versions (as present in `QubesOS`).

I can run this `*.sls`fine on `dom0` (where it doesn't make much sense, respectively the change isn't necessary), but if I target the templates (and particularly the one `sys-net` is based on), `salt` balks on the first line. There's a lot of traceback, but the most readable message appears to be along the lines of

`Jinja error: get() missing 1 required positional argument: 'default'`

Does anyone have any pointers as to what may be going on here, how to better debug (error output from `dom0`--> Email VM?) and how to fix?

Thanks in advance.

Joh


Frédéric Pierret

unread,
May 3, 2022, 5:33:11 AM5/3/22
to Johannes Graumann, qubes...@googlegroups.com
Hello,

Just writing what I'm thinking (not Salt expert at all!), you are probably missing default value in the .get(): .get('kernelrelease', SOMETHING_DEFAULT)

Le 5/3/22 à 11:01, 'Johannes Graumann' via qubes-users a écrit :
Best,
Frédéric
OpenPGP_signature

Johannes Graumann

unread,
May 3, 2022, 9:45:11 AM5/3/22
to Frédéric Pierret, qubes...@googlegroups.com
Hm. But why does it then work in `dom0`?
Reply all
Reply to author
Forward
0 new messages