Rebased patch

This commit is contained in:
morsik 2015-11-24 21:43:07 +01:00
parent bf28971bd7
commit 78e7fb9d0d

View file

@ -64,19 +64,23 @@ global
{{- render_list_of_dictionaries('ssl-default-bind-options', salt['pillar.get']('haproxy:global:ssl-default-bind-options')) }} {{- render_list_of_dictionaries('ssl-default-bind-options', salt['pillar.get']('haproxy:global:ssl-default-bind-options')) }}
{%- endif %} {%- endif %}
<<<<<<< HEAD
{%- for id, userlist in salt['pillar.get']('haproxy:userlists', {}).items() %} {%- for id, userlist in salt['pillar.get']('haproxy:userlists', {}).items() %}
=======
{%- for id, userlist in salt['pillar.get']('haproxy:userlists', {})|dictsort %}
>>>>>>> Use dictsort instead of iteritems()/items()
#------------------ #------------------
# Global Userlists # Global Userlists
#------------------ #------------------
userlist {{ id }} userlist {{ id }}
{%- for id, entry in userlist.items() %} {%- for id, entry in userlist|dictsort %}
{%- if id == "groups" %} {%- if id == "groups" %}
{%- for group_name, group in entry.items() %} {%- for group_name, group in entry|dictsort %}
group {{ group_name }} {{ group }} group {{ group_name }} {{ group }}
{%- endfor %} {%- endfor %}
{% endif %} {% endif %}
{%- if id == "users" %} {%- if id == "users" %}
{%- for user_name, user in entry.items() %} {%- for user_name, user in entry|dictsort %}
user {{ user_name }} {{ user }} user {{ user_name }} {{ user }}
{%- endfor %} {%- endfor %}
{% endif %} {% endif %}
@ -118,7 +122,7 @@ defaults
{{ render_list_of_dictionaries('stats', salt['pillar.get']('haproxy:defaults:stats')) }} {{ render_list_of_dictionaries('stats', salt['pillar.get']('haproxy:defaults:stats')) }}
{%- endif %} {%- endif %}
{%- if 'errorfiles' in salt['pillar.get']('haproxy:defaults', {}) %} {%- if 'errorfiles' in salt['pillar.get']('haproxy:defaults', {}) %}
{%- for errorfile_name, errorfile in salt['pillar.get']('haproxy:defaults:errorfiles').items() %} {%- for errorfile_name, errorfile in salt['pillar.get']('haproxy:defaults:errorfiles')|dictsort %}
errorfile {{ errorfile_name }} {{ errorfile }} errorfile {{ errorfile_name }} {{ errorfile }}
{%- endfor %} {%- endfor %}
{% endif %} {% endif %}
@ -128,7 +132,7 @@ defaults
#------------------ #------------------
# DNS resolvers # DNS resolvers
#------------------ #------------------
{%- for resolver_name, resolver in salt['pillar.get']('haproxy:resolvers', {}).items() %} {%- for resolver_name, resolver in salt['pillar.get']('haproxy:resolvers', {})|dictsort %}
resolvers {{ resolver_name }} resolvers {{ resolver_name }}
{%- if 'options' in resolver %} {%- if 'options' in resolver %}
{%- for option in resolver.options %} {%- for option in resolver.options %}
@ -142,7 +146,7 @@ resolvers {{ resolver_name }}
#------------------ #------------------
# listen instances # listen instances
#------------------ #------------------
{%- for listener_name, listener in salt['pillar.get']('haproxy:listens', {}).items() %} {%- for listener_name, listener in salt['pillar.get']('haproxy:listens', {})|dictsort %}
listen {{ listener.get('name', listener_name) }} listen {{ listener.get('name', listener_name) }}
{%- if 'bind' in listener %} {%- if 'bind' in listener %}
{%- if listener.bind is string %} {%- if listener.bind is string %}
@ -288,7 +292,7 @@ listen {{ listener.get('name', listener_name) }}
cookie {{ listener.cookie }} cookie {{ listener.cookie }}
{%- endif %} {%- endif %}
{%- if 'stats' in listener %} {%- if 'stats' in listener %}
{%- for option, value in listener.stats.items() %} {%- for option, value in listener.stats|dictsort %}
{%- if option == 'enable' and value %} {%- if option == 'enable' and value %}
stats enable stats enable
{%- else %} {%- else %}
@ -304,10 +308,10 @@ listen {{ listener.get('name', listener_name) }}
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- if 'defaultserver' in listener %} {%- if 'defaultserver' in listener %}
default-server {%- for option, value in listener.defaultserver.items() %} {{ ' '.join((option, value|string, '')) }} {%- endfor %} default-server {%- for option, value in listener.defaultserver|dictsort %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
{%- endif %} {%- endif %}
{%- if 'servers' in listener %} {%- if 'servers' in listener %}
{%- for server_name, server in listener.servers.items()|sort %} {%- for server_name, server in listener.servers|dictsort %}
server {{ server.get('name', server_name) }} {{ server.host }}:{{ server.port }} {{ server.check }} {{ server.get('extra', '') }} server {{ server.get('name', server_name) }} {{ server.host }}:{{ server.port }} {{ server.check }} {{ server.get('extra', '') }}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
@ -318,7 +322,7 @@ listen {{ listener.get('name', listener_name) }}
#------------------ #------------------
# frontend instances # frontend instances
#------------------ #------------------
{%- for frontend_name, frontend in salt['pillar.get']('haproxy:frontends', {}).items() %} {%- for frontend_name, frontend in salt['pillar.get']('haproxy:frontends', {})|dictsort %}
frontend {{ frontend.get('name', frontend_name) }} frontend {{ frontend.get('name', frontend_name) }}
{%- if 'bind' in frontend %} {%- if 'bind' in frontend %}
{{- render_list_of_dictionaries('bind', frontend.bind) }} {{- render_list_of_dictionaries('bind', frontend.bind) }}
@ -396,7 +400,7 @@ frontend {{ frontend.get('name', frontend_name) }}
#------------------ #------------------
# backend instances # backend instances
#------------------ #------------------
{%- for backend_name, backend in salt['pillar.get']('haproxy:backends', {}).items() %} {%- for backend_name, backend in salt['pillar.get']('haproxy:backends', {})|dictsort %}
backend {{ backend.get('name', backend_name) }} backend {{ backend.get('name', backend_name) }}
{%- if 'mode' in backend %} {%- if 'mode' in backend %}
mode {{ backend.mode }} mode {{ backend.mode }}
@ -476,7 +480,7 @@ backend {{ backend.get('name', backend_name) }}
cookie {{ backend.cookie }} cookie {{ backend.cookie }}
{%- endif %} {%- endif %}
{%- if 'stats' in backend %} {%- if 'stats' in backend %}
{%- for option, value in backend.stats.items() %} {%- for option, value in backend.stats|dictsort %}
{%- if option == 'enable' and value %} {%- if option == 'enable' and value %}
stats enable stats enable
{%- else %} {%- else %}
@ -495,10 +499,10 @@ backend {{ backend.get('name', backend_name) }}
{{- render_list_of_dictionaries('reqrep', backend.reqreps) }} {{- render_list_of_dictionaries('reqrep', backend.reqreps) }}
{%- endif %} {%- endif %}
{%- if 'defaultserver' in backend %} {%- if 'defaultserver' in backend %}
default-server {%- for option, value in backend.defaultserver.items() %} {{ ' '.join((option, value|string, '')) }} {%- endfor %} default-server {%- for option, value in backend.defaultserver|dictsort %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
{%- endif %} {%- endif %}
{%- if 'servers' in backend %} {%- if 'servers' in backend %}
{%- for server_name, server in backend.servers.items()|sort %} {%- for server_name, server in backend.servers|dictsort %}
server {{ server.get('name', server_name) }} {{ server.host }}:{{ server.port }} {{ server.check }} {{ server.get('extra', '') }} server {{ server.get('name', server_name) }} {{ server.host }}:{{ server.port }} {{ server.check }} {{ server.get('extra', '') }}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}