1b8b1c67b77b2e7cd6b1f96fc168efd5694baaf0
[arvados-formula.git] / TEMPLATE / map.jinja
1 # -*- coding: utf-8 -*-
2 # vim: ft=jinja
3
4 {#- Get the `tplroot` from `tpldir` #}
5 {%- set tplroot = tpldir.split('/')[0] %}
6 {#- Start imports as #}
7 {%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
8 {%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
9 {%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
10 {%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
11 {%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
12
13 {#- Retrieve the config dict only once #}
14 {%- set _config = salt['config.get'](tplroot, default={}) %}
15
16 {%- set defaults = salt['grains.filter_by'](
17       default_settings,
18       default=tplroot,
19       merge=salt['grains.filter_by'](
20         osarchmap,
21         grain='osarch',
22         merge=salt['grains.filter_by'](
23           osfamilymap,
24           grain='os_family',
25           merge=salt['grains.filter_by'](
26             osmap,
27             grain='os',
28             merge=salt['grains.filter_by'](
29               osfingermap,
30               grain='osfinger',
31               merge=salt['grains.filter_by'](
32                 _config,
33                 default='lookup'
34               )
35             )
36           )
37         )
38       )
39     )
40 %}
41
42 {%- set config = salt['grains.filter_by'](
43       {'defaults': defaults},
44       default='defaults',
45       merge=_config
46     )
47 %}
48
49 {#- Change **TEMPLATE** to match with your formula's name and then remove this line #}
50 {%- set TEMPLATE = config %}
51
52 {#- Post-processing for specific non-YAML customisations #}
53 {%- if grains.os == 'MacOS' %}
54 {%-   set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
55 {%-   do TEMPLATE.update({'rootgroup': macos_group}) %}
56 {%- endif %}