one for-loop for all of the mappings

This commit is contained in:
Florian Ermisch 2017-08-24 13:10:54 +02:00 committed by Wurzel Kollektiv
parent 136e02a61c
commit 8eed254773
1 changed files with 14 additions and 9 deletions

View File

@ -97,17 +97,22 @@ policy-spf_time_limit = {{ policyd_spf.get('time_limit', '3600s') }}
{%- endif %} {%- endif %}
{{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }} {{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }}
{% if 'virtual' in pillar.get('postfix','') %} {# From init.sls #}
virtual_alias_maps = hash:/etc/postfix/virtual {%- set default_database_type = salt['pillar.get']('postfix:config:default_database_type', 'hash') %}
{% endif %}
{% if 'sasl_passwd' in pillar.get('postfix','') %} {%- for mapping, data in salt['pillar.get']('postfix:mapping', {}).items() %}
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd {%- set file_path = salt['pillar.get']('postfix:config:' ~ mapping) %}
{% endif %} {%- if ':' in file_path %}
{%- set file_type, file_path = file_path.split(':') %}
{%- else %}
{%- set file_type = default_database_type %}
{%- endif %}
{%- if not file_path.startswith('/') %}
{%- set file_path = postfix.config_path ~ '/' ~ file_path %}
{%- endif %}
{% if 'sender_canonical' in pillar.get('postfix','') %} {{ mapping }} = {{ file_type }}:{{ file_path }}
sender_canonical_maps = hash:/etc/postfix/sender_canonical {% endfor %}
{% endif %}
{# Accept arbitrary parameters -#} {# Accept arbitrary parameters -#}
{% for parameter in config -%} {% for parameter in config -%}