Making the macro recursive.

This commit is contained in:
Jeff Baskin 2016-10-23 19:17:58 -04:00
parent 0019a1bc95
commit 762129427e

View File

@ -4,17 +4,19 @@
# #
# This file is managed by Salt. # This file is managed by Salt.
# Any changes will be overwritten. # Any changes will be overwritten.
{{ '\n' }}
{%- import_yaml 'keepalived/defaults.yaml' as keepalived_defaults %} {%- import_yaml 'keepalived/defaults.yaml' as keepalived_defaults %}
{%- set keepalived_final_values = salt.pillar.get( {%- set keepalived_final_values = salt.pillar.get(
'keepalived', 'keepalived:',
default=keepalived_defaults, default=keepalived_defaults,
merge=True) %} merge=True) %}
{%- macro config_entries(data) -%} {%- macro config_entries(data) -%}
{%- if data is mapping -%} {%- if data is mapping -%}
{%- for entry_type in data|dictsort -%} {%- for entry_type in data|dictsort -%}
{{ entry_type }}{{ '\n' }} {{ entry_type }} {
{{ config_entries(data[entry_type]) }}
}{{ '\n' }}
{%- endfor -%} {%- endfor -%}
{%- endif -%} {%- endif -%}
{%- endmacro -%} {%- endmacro -%}