Add support for default_database_type configuration option

See github issue #50.
This commit is contained in:
Gilles Dartiguelongue 2016-12-29 11:51:09 +01:00
parent 7ce8798709
commit b2fc0f1c0b

View File

@ -12,6 +12,9 @@ postfix:
- watch: - watch:
- pkg: postfix - pkg: postfix
{# Used for newaliases, postalias and postconf #}
{%- set default_database_type = salt['pillar.get']('postfix:config:default_database_type', 'hash') %}
# manage /etc/aliases if data found in pillar # manage /etc/aliases if data found in pillar
{% if 'aliases' in pillar.get('postfix', '') %} {% if 'aliases' in pillar.get('postfix', '') %}
{{ postfix.aliases_file }}: {{ postfix.aliases_file }}:
@ -38,9 +41,11 @@ run-newaliases:
{%- set file_path = salt['pillar.get']('postfix:config:' ~ mapping) %} {%- set file_path = salt['pillar.get']('postfix:config:' ~ mapping) %}
{%- if ':' in file_path %} {%- if ':' in file_path %}
{%- set file_type, file_path = file_path.split(':') %} {%- set file_type, file_path = file_path.split(':') %}
{%- if file_type in ("btree", "cdb", "dbm", "hash", "sdbm") %} {%- else %}
{%- set need_postmap = True %} {%- set file_type = default_database_type %}
{%- endif %} {%- endif %}
{%- if file_type in ("btree", "cdb", "dbm", "hash", "sdbm") %}
{%- set need_postmap = True %}
{%- endif %} {%- endif %}
postfix_{{ mapping }}: postfix_{{ mapping }}:
file.managed: file.managed: