Please guidance and resources.
I am writing an .sls
to configure my desktop menu, but I’m failing and I need help to understand what is wrong. I inserted some tracing calls like: do salt.log.warning( str )
, and that has helped, but I still think I must put more reading on Salt/Jinja context.
Output from sudo qubesctl --show-output state.highstate
[WARNING ] calling cp_files()
[WARNING ] inside for loop, vm:
[WARNING ] sec-blue
[WARNING ] inside kitty.set_vm( vm ), argument:
[WARNING ] sec-blue
[WARNING ] inside for loop, vm:
[WARNING ] sec-red
[WARNING ] inside kitty.set_vm( vm ), argument:
[WARNING ] sec-red
[WARNING ]
sec-blue-menus-kitty-file:
file.managed:
- names:
- ~/.local/share/qubes-appmenus/sec-blue/apps/org.qubes-os.vm.sec-blue.kitty.desktop:
- source: salt://menus/org.qubes-os.vm.template.kitty.desktop
sec-blue-menus-kitty-icon:
file.managed:
- names:
- ~/.local/share/qubes-appmenus/sec-blue/apps.icons/kitty.png
- source: salt://menus/kitty.png
sec-blue-menus-conf-script:
cmd.run:
- require:
- sec-blue-menus-kitty-file
- name: 'bash $HOME/bkp/conf-salt/menus/conf-menus.sh sec-blue'
sec-red-menus-kitty-file:
file.managed:
- names:
- ~/.local/share/qubes-appmenus/sec-red/apps/org.qubes-os.vm.sec-red.kitty.desktop:
- source: salt://menus/org.qubes-os.vm.template.kitty.desktop
sec-red-menus-kitty-icon:
file.managed:
- names:
- ~/.local/share/qubes-appmenus/sec-red/apps.icons/kitty.png
- source: salt://menus/kitty.png
sec-red-menus-conf-script:
cmd.run:
- require:
- sec-red-menus-kitty-file
- name: 'bash $HOME/bkp/conf-salt/menus/conf-menus.sh sec-red'
[WARNING ] inside for loop, vm:
[WARNING ] sec-blue
[WARNING ] inside kitty.set_vm( vm ), argument:
[WARNING ] sec-blue
[WARNING ] inside for loop, vm:
[WARNING ] sec-red
[WARNING ] inside kitty.set_vm( vm ), argument:
[WARNING ] sec-red
[CRITICAL] Rendering SLS 'user:menus.conf' failed: mapping values are not allowed in this context
local:
Data failed to compile:
----------
Rendering SLS 'user:menus.conf' failed: mapping values are not allowed in this context
DOM0 configuration failed, not continuing
menus/conf.sls
# menus/conf.sls
# user: dom0:
{% set vms = [
'sec-blue', 'sec-red'
] %}
{% set apps = [
'kitty', 'vlc'
] %}
{% import "menus/org.qubes-os.vm.template.kitty.desktop" as kitty with context %}
{% macro cp_files( vms )%}
{% for vm in vms %}
{% do salt.log.warning( 'inside for loop, vm:' ) -%}
{% do salt.log.warning( vm ) -%}
{{ kitty.set_vm( vm ) }}
{{vm}}-menus-kitty-file:
file.managed:
- names:
- ~/.local/share/qubes-appmenus/{{vm}}/apps/org.qubes-os.vm.{{vm}}.kitty.desktop:
- source: salt://menus/org.qubes-os.vm.template.kitty.desktop
{{vm}}-menus-kitty-icon:
file.managed:
- names:
- ~/.local/share/qubes-appmenus/{{vm}}/apps.icons/kitty.png
- source: salt://menus/kitty.png
{{vm}}-menus-conf-script:
cmd.run:
- require:
- {{vm}}-menus-kitty-file
- name: 'bash $HOME/bkp/conf-salt/menus/conf-menus.sh {{vm}}'
{% endfor %}
{% endmacro %}
{% do salt.log.warning( 'calling cp_files()' ) -%}
# {% do salt.log.warning( cp_files( vms ) ) -%}
{{ cp_files( vms )}}
menus/org.qubes-os.vm.template.kitty.desktop
{% set vm = '' %}
{% macro set_vm ( i )%}
{% do salt.log.warning( 'inside kitty.set_vm( vm ), argument:' ) -%}
{% do salt.log.warning( i ) -%}
{% set vm = i %}
{% endmacro %}
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
X-Qubes-VmName={{vm}}
X-Qubes-AppName=kitty
Icon=/home/xr/.local/share/qubes-appmenus/{{vm}}/apps.icons/kitty.png
Name={{vm}}: kitty
GenericName={{vm}}: Terminal emulator
Comment=A fast, feature full, GPU based terminal emulator
Categories=System;TerminalEmulator;X-Qubes-VM;
Exec=qvm-run -q -a --service -- {{vm}} qubes.StartApp+kitty
X-Qubes-DispvmExec=qvm-run -q -a --service --dispvm={{vm}} -- qubes.StartApp+kitty
menus/conf-menus.sh
#!/bin/bash
VM=$1
xdg-desktop-menu uninstall ~/.local/share/desktop-directories/qubes-vm-directory-${VM}.directory ~/.local/share/qubes-appmenus/sec-red/apps/org.qubes-os.vm.${VM}.thunderbird.desktop
xdg-desktop-menu install ~/.local/share/desktop-directories/qubes-vm-directory-${VM}.directory ~/.local/share/qubes-appmenus/sec-red/apps/org.qubes-os.vm.${VM}.kitty.desktop
Qubes: 4.1.2