From 1a5027ef8c6bcf970c13b6b2b373d635e1b4e83d Mon Sep 17 00:00:00 2001 From: Matthew Richardson Date: Fri, 22 Jun 2018 09:41:10 +0100 Subject: [PATCH] Handle pillar params with child params. (#372) --- salt/files/master.d/f_defaults.conf | 11 +++++++++++ salt/files/minion.d/f_defaults.conf | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/salt/files/master.d/f_defaults.conf b/salt/files/master.d/f_defaults.conf index 2f94150..e3a6ba7 100644 --- a/salt/files/master.d/f_defaults.conf +++ b/salt/files/master.d/f_defaults.conf @@ -1168,7 +1168,18 @@ ext_pillar: {%- elif pillar[key] is iterable and 'dict' not in pillar[key].__class__.__name__ %} - {{ key }}: {%- for parameter in pillar[key] %} + {%- if parameter is iterable and parameter is not string %} + {%- for param, children in parameter.items() %} + - {{ param }}: + {%- for child in children %} + {%- for key, value in child.items() %} + - {{ key }}: {{ value }} + {%- endfor -%} + {%- endfor -%} + {%- endfor -%} + {%- else %} - {{ parameter }} + {%- endif %} {%- endfor -%} {#- Workaround for missing `is mapping` on CentOS 6, see #193: #} {%- elif 'dict' in pillar[key].__class__.__name__ and pillar[key] is not string %} diff --git a/salt/files/minion.d/f_defaults.conf b/salt/files/minion.d/f_defaults.conf index 0303fd0..b190459 100644 --- a/salt/files/minion.d/f_defaults.conf +++ b/salt/files/minion.d/f_defaults.conf @@ -842,7 +842,18 @@ ext_pillar: {%- elif pillar[key] is iterable and 'dict' not in pillar[key].__class__.__name__ %} - {{ key }}: {%- for parameter in pillar[key] %} + {%- if parameter is iterable and parameter is not string %} + {%- for param, children in parameter.items() %} + - {{ param }}: + {%- for child in children %} + {%- for key, value in child.items() %} + - {{ key }}: {{ value }} + {%- endfor -%} + {%- endfor -%} + {%- endfor -%} + {%- else %} - {{ parameter }} + {%- endif %} {%- endfor -%} {#- Workaround for missing `is mapping` on CentOS 6, see #193: #} {%- elif 'dict' in pillar[key].__class__.__name__ and pillar[key] is not string %}