formula-postfix/postfix/files/mapping.j2

25 lines
725 B
Text
Raw Normal View History

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