# -*- coding: utf-8 -*-
# vim: ft=jinja

{#- Start imports #}
{% import_yaml "salt/defaults.yaml" as defaults %}
{% import_yaml "salt/osfamilymap.yaml" as osfamilymap %}
{% import_yaml "salt/osmap.yaml" as osmap %}
{% import_yaml "salt/osfingermap.yaml" as osfingermap %}

{# merge the osfamilymap #}
{% set osfamily_map = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %}
{% do salt['defaults.merge'](defaults['salt'], osfamily_map) %}

{# merge the osmap #}
{% set os_map = salt['grains.filter_by'](osmap, grain='os') or {} %}
{% do salt['defaults.merge'](defaults['salt'], os_map) %}

{# merge the osfingermap #}
{% set osfinger_map = salt['grains.filter_by'](osfingermap, grain='osfinger') or {} %}
{% do salt['defaults.merge'](defaults['salt'], osfinger_map) %}

{# merge the lookup #}
{% set lookup = salt['pillar.get']('salt:lookup', default={}, merge=True) %}
{% do salt['defaults.merge'](defaults['salt'], lookup) %}

{#- Merge in salt pillar #}
{% set salt_settings = salt['pillar.get']('salt', default=defaults['salt'], merge=True) %}

{#- Merge in salt_formulas pillar #}
{% set formulas_settings = salt['pillar.get']('salt_formulas',default=defaults['salt_formulas'], merge=True) %}