Merge pull request #90 from alxwr/fix-89
Fix #89 by ignoring only keys which are actually used in Pillar 'postfix:mapping'
This commit is contained in:
commit
19f5de8383
@ -235,3 +235,24 @@ postfix:
|
|||||||
- someuser_1@example.com
|
- someuser_1@example.com
|
||||||
- someuser_2@example.com
|
- someuser_2@example.com
|
||||||
- singlealiasexample: someuser_3@example.com
|
- singlealiasexample: someuser_3@example.com
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
#
|
||||||
|
# Multiple virtual_alias_maps entries:
|
||||||
|
#
|
||||||
|
# You are free to define alternative mapping names
|
||||||
|
# and use them as 'variables' in your Postfix config:
|
||||||
|
# (Credit for the idea and the example goes to @roskens.)
|
||||||
|
|
||||||
|
postfix:
|
||||||
|
config:
|
||||||
|
virtual_alias_maps: $virtual_alias_1_maps $virtual_alias_2_maps
|
||||||
|
virtual_alias_1_maps: hash:/etc/postfix/virtual
|
||||||
|
virtual_alias_2_maps: pcre:/etc/postfix/virtual.pcre
|
||||||
|
mapping:
|
||||||
|
virtual_alias_1_maps:
|
||||||
|
root:
|
||||||
|
- me
|
||||||
|
virtual_alias_2_maps:
|
||||||
|
- '/(\S+)_(devel|preprod|prod)@sub.example.com$/': '$(1)@$(2).sub.example.com'
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
{%- from "postfix/map.jinja" import postfix with context -%}
|
{%- from "postfix/map.jinja" import postfix with context -%}
|
||||||
{%- set config = salt['pillar.get']('postfix:config', {}) -%}
|
{%- set config = salt['pillar.get']('postfix:config', {}) -%}
|
||||||
|
|
||||||
{%- if not salt['pillar.get']('postfix:mapping', False) %}
|
{#- " | list": Python3.6 retuns dict_keys here, which needs to be converted into a list here. -#}
|
||||||
{#- Let the user configure mapping manually. -#}
|
{%- set processed_parameters = salt['pillar.get']('postfix:mapping', {}).keys() | list %}
|
||||||
{%- set processed_parameters = [] %}
|
|
||||||
{%- else -%}
|
|
||||||
{#- TODO: alias_maps probably belongs here, too: #}
|
|
||||||
{%- set processed_parameters = [
|
|
||||||
'virtual_alias_maps',
|
|
||||||
'smtp_sasl_password_maps',
|
|
||||||
'sender_canonical_maps',
|
|
||||||
] %}
|
|
||||||
{%- endif -%}
|
|
||||||
|
|
||||||
{%- macro set_parameter(parameter, default=None) -%}
|
{%- macro set_parameter(parameter, default=None) -%}
|
||||||
{% set value = config.get(parameter, default) %}
|
{% set value = config.get(parameter, default) %}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
{%- else %}
|
{%- else %}
|
||||||
{#- Some settings need order, handle OrderedDict #}
|
{#- Some settings need order, handle OrderedDict #}
|
||||||
{% for item in data %}
|
{% for item in data %}
|
||||||
{{ format_value(item.keys()[0], item.values()[0]) }}
|
{%- set key, value = item.popitem() %}
|
||||||
|
{{ format_value(key, value) }}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user