Commit 6544687b authored by Philippe Pepiot's avatar Philippe Pepiot Committed by Denis Laxalde
Browse files

map.jinja: fix nested pillar inheritance

The main issue was in ``default_settings.saemref.update(os_family_map)``
which not handle nested pillars we use.

Use 'base' parameter of grains.filter_by() instead which perform deep
merge as we want.

Also use 'lookup' section in test pillars like in pillar.examples
parent aa7b3709
{% import_yaml 'saemref/defaults.yaml' as default_settings %}
{% set os_family_map = salt['grains.filter_by']({
{% set saemref = salt['pillar.get'](
'saemref',
default=salt['grains.filter_by']({
'Debian': {
'supervisor_conffile': '/etc/supervisor/conf.d/saemref.conf',
'supervisor_service_name': 'supervisor',
......@@ -9,18 +11,9 @@
'supervisor_conffile': '/etc/supervisord.d/saemref.ini',
'supervisor_service_name': 'supervisord',
},
},
grain="os_family",
merge=salt['pillar.get']('saemref:lookup'))
%}
{% do default_settings.saemref.update(os_family_map) %}
{% set saemref = salt['pillar.get'](
'saemref',
default=default_settings.saemref,
merge=True,
)
'base': default_settings.saemref,
}, grain='os_family', base='base', merge=salt['pillar.get']('saemref:lookup')),
merge=True)
%}
{% set is_docker_build = (salt['cmd.retcode']('/bin/sh -c "(readlink -f /sbin/init | grep -q systemd) && ! (readlink -f /proc/1/exe | grep systemd)"') == 0) %}
saemref:
install:
dev: true
lookup:
install:
dev: true
saemref:
instance:
test_mode: true
{% for ip in grains['ipv4'] -%}
{% if ip != '127.0.0.1' -%}
base_url: http://{{ ip }}:8080
{% break %}
{% endif %}
{% endfor %}
sessions_secret: Polichinelle
authtk_session_secret: Polichinelle1
authtk_persistent_secret: Polichinelle2
anonymous_user: anon
anonymous_password: anon
db:
driver: sqlite
name: /home/saemref/saemref.db
lookup:
instance:
test_mode: true
{% for ip in grains['ipv4'] -%}
{% if ip != '127.0.0.1' -%}
base_url: http://{{ ip }}:8080
{% break %}
{% endif %}
{% endfor %}
sessions_secret: Polichinelle
authtk_session_secret: Polichinelle1
authtk_persistent_secret: Polichinelle2
anonymous_user: anon
anonymous_password: anon
db:
driver: sqlite
name: /home/saemref/saemref.db
postgres:
version: 9.4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment