From bc7ccedf45ec87868d305417c51baf790ae310a1 Mon Sep 17 00:00:00 2001 From: Wes Turner Date: Tue, 22 Jul 2014 00:43:24 -0500 Subject: [PATCH] Fix nested file,pillar _roots in minion and master templates See #37 "Fixed file_roots config generation with several environment" --- salt/files/master | 4 ++-- salt/files/minion | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/salt/files/master b/salt/files/master index a1344fd..14ddc8f 100644 --- a/salt/files/master +++ b/salt/files/master @@ -521,9 +521,9 @@ pillar_roots: {%- endfor -%} {% elif 'pillar_roots' in salt -%} pillar_roots: -{%- for name, roots in salt['pillar_roots'].items() -%} +{%- for name, roots in salt['pillar_roots']|dictsort %} {{ name }}: -{%- for dir in roots -%} +{%- for dir in roots %} - {{ dir }} {%- endfor -%} {%- endfor -%} diff --git a/salt/files/minion b/salt/files/minion index d03f3d8..67ca28b 100644 --- a/salt/files/minion +++ b/salt/files/minion @@ -404,20 +404,20 @@ id: {{ minion['id'] }} # {% if 'file_roots' in minion -%} file_roots: - {% for name, roots in minion['file_roots'].items() -%} +{%- for name, roots in minion['file_roots']|dictsort %} {{ name }}: - {% for dir in roots -%} - - {{ dir }} - {% endfor -%} - {% endfor -%} +{%- for dir in roots %} + - {{ dir }} +{%- endfor -%} +{%- endfor -%} {% elif 'file_roots' in salt -%} file_roots: - {% for name, roots in salt['file_roots'].items() -%} +{%- for name, roots in salt['file_roots']|dictsort %} {{ name }}: - {% for dir in roots -%} - - {{ dir }} - {% endfor -%} - {% endfor -%} +{%- for dir in roots %} + - {{ dir }} +{%- endfor -%} +{%- endfor -%} {% else -%} #file_roots: # base: @@ -444,24 +444,24 @@ file_roots: # also be configured on the minion: {% if 'pillar_roots' in minion -%} pillar_roots: - {% for name, roots in minion['pillar_roots'].items() -%} +{%- for name, roots in minion['pillar_roots']|dictsort %} {{ name }}: - {% for dir in roots -%} - - {{ dir }} - {% endfor -%} - {% endfor -%} +{%- for dir in roots %} + - {{ dir }} +{%- endfor -%} +{%- endfor -%} {% elif 'pillar_roots' in salt -%} pillar_roots: - {% for name, roots in salt['pillar_roots'].items() -%} +{%- for name, roots in salt['pillar_roots']|dictsort %} {{ name }}: - {% for dir in roots -%} - - {{ dir }} - {% endfor -%} - {% endfor -%} -{% else %} +{%- for dir in roots %} + - {{ dir }} +{%- endfor -%} +{%- endfor -%} +{% else -%} #pillar_roots: # base: -# - /srv/pillar +# - /srv/salt {%- endif %} ###### Security settings #####