From 762129427e71d46dc7aeef1143ddfa688bdf7100 Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Sun, 23 Oct 2016 19:17:58 -0400 Subject: [PATCH] Making the macro recursive. --- keepalived/templates/keepalived.jinja | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/keepalived/templates/keepalived.jinja b/keepalived/templates/keepalived.jinja index 5fe5c23..899aff7 100644 --- a/keepalived/templates/keepalived.jinja +++ b/keepalived/templates/keepalived.jinja @@ -4,17 +4,19 @@ # # This file is managed by Salt. # Any changes will be overwritten. - +{{ '\n' }} {%- import_yaml 'keepalived/defaults.yaml' as keepalived_defaults %} {%- set keepalived_final_values = salt.pillar.get( - 'keepalived', + 'keepalived:', default=keepalived_defaults, merge=True) %} {%- macro config_entries(data) -%} {%- if data is mapping -%} {%- for entry_type in data|dictsort -%} -{{ entry_type }}{{ '\n' }} +{{ entry_type }} { +{{ config_entries(data[entry_type]) }} +}{{ '\n' }} {%- endfor -%} {%- endif -%} {%- endmacro -%}