Hi guys!
I am having some trouble merging some salt pillars, and was wondering if anyone 
here has experience with this.
I have some default settings in a yaml file, and am trying to overwrite values 
based on vm types.
I get the wanted behaviour from running something like "qubesctl --show-output 
--targets dom0 defaults.merge '{a: {b: 1.1, c: 2.1}}' '{a: {b: 1.2}}'" from the 
terminal:
--------------------------------------------------
a:
  b:
    - 1.2
  c:
    - 2.1
--------------------------------------------------
(b is overwritten, but c remains untouched)
When using slsutil.renderer on the map.jinja, the whole list is replaced 
instead, leaving only completely untouched lists and new values:
--------------------------------------------------
dvm:
  vcpus:
    - 2
disp:
  vcpus:
    - 2
template:
  source:
    - d10m
  include_in_backups:
    - True 
--------------------------------------------------
default_prefs.yaml:
--------------------------------------------------
template:
  - source: d10m
  - include_in_backups: True
dvm:
  - netvm: none
  - provides_network: False
  - klass: AppVM
  - template_for_dispvms: True
  - default_dispvm: none
  - default_user: user
  - vcpus: 1
  - memory: 300
  - maxmem: 4096
  - kernel: 5.4.107-1.fc25
  - kernelopts: nopat apparmor=1 security=apparmor
  - virt_mode: pvh
  - label: gray
  - include_in_backups: True
disp:
  - netvm: none
  - klass: DispVM
  - default_dispvm: none
  - default_user: user
  - vcpus: 1
  - memory: 300
  - maxmem: 4096
  - kernel: 5.4.107-1.fc25
  - kernelopts: nopat apparmor=1 security=apparmor
  - virt_mode: pvh
  - label: black
  - include_in_backups: True
--------------------------------------------------
map.jinja:
--------------------------------------------------
{% import_yaml 
'/srv/salt/user_pillar/base/vm_prefs/templates/default_prefs.yaml' as 
default_settings %}

{#{% if grains['id'].endswith('med') %}#}
# what makes the type different from default
{%- load_yaml as type_diff %}
dvm:
  - vcpus: 2
disp:
  - vcpus: 2
{% endload %}
{#{% endif %}#}
{% set merged = salt['defaults.merge'](default_settings,type_diff) %}
{{ merged }}
--------------------------------------------------
I noticed that some functions(defaults.update) and 
arguments(merge_lists,in_place) are not available for the installed salt 
version, do I need those ?

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20210414183258.GA878%40mail2-dvm.

Reply via email to