formula-postfix/postfix/files/virtual_mailbox_domains.cf

25 lines
951 B
CFEngine3
Raw Normal View History

{%- if 'mysql' in salt['pillar.get']('postfix:config:virtual_mailbox_domains', '') %}
{%- set config = salt['pillar.get']('postfix:mysql:virtual_mailbox_domains', {}) -%}
{%- for key,value in salt['pillar.get']('postfix:vmail').items() %}
{{ key }} = {{ value }}
{%- endfor %}
query = SELECT {{ config.select_field|default('1') }} FROM {{ config.table|default('virtual_domains') }} WHERE {{ config.where_field|default('name') }}='%s'
{%- else %}
2015-06-20 19:18:55 -04:00
{% set config = salt['pillar.get']('postfix:vmail', {}) -%}
{% macro set_parameter(parameter, default=None) -%}
{% set value = config.get(parameter, default) -%}
{% if value is not none -%}
{{ parameter }} = {{ value }}
{% endif -%}
{% endmacro -%}
{# Accept arbitrary parameters -#}
{% for parameter in config -%}
{{ set_parameter(parameter) }}
{% endfor -%}
{{ set_parameter('table', 'domain') }}
{{ set_parameter('select_field', 'domain') }}
{{ set_parameter('where_field', 'domain') }}
{%- endif %}