formula-postfix/postfix/files/mapping.j2
Gilles Dartiguelongue 62ab827c34 Replace postmap_macro by generic handling of map files
Merge existing handling of postfix lookup table/map files into a single
template. Mappings are read from pillar in `postfix:mapping`.
Configuration is written to the file pointed to by the relevant
directive in `postfix:config`. A single target file is supported at the
moment. The file is postmap'ed if needed.

The pillar accepts a dict or an OrderedDict.
2016-06-20 18:41:43 +02:00

20 lines
558 B
Django/Jinja

# Managed by config management
{% if data is mapping -%}
{% for key, value in data.iteritems() -%}
{# Some settings, like virtual_alias_maps can take multiple values. Handle this case. -#}
{% if value is iterable and value is not string -%}
{% for item in value -%}
{{ key }} {{ item }}
{% endfor -%}
{% else -%}
{{ key }} {{ value }}
{% endif -%}
{% endfor -%}
{% else -%}
{# Some settings need order, handle OrderedDict -#}
{% for item in data -%}
{{ item.keys()[0] }} {{ item.values()[0] }}
{% endfor -%}
{% endif -%}