Use dictsort instead of iteritems

to process entries in deterministic order
This commit is contained in:
Bernhard M. Wiedemann 2018-09-04 21:10:24 +02:00
parent 353a8dfc15
commit 7f500766e0
2 changed files with 4 additions and 4 deletions

View file

@ -129,7 +129,7 @@ logging {
{%- if salt['pillar.get']('bind:controls', False) %}
controls {
{%- for name, control in salt['pillar.get']('bind:controls').iteritems() if control.get('enabled', True) %}
{%- for name, control in salt['pillar.get']('bind:controls')|dictsort if control.get('enabled', True) %}
inet {{ control.get('bind', {}).get('address', '127.0.0.1') }} port {{ control.get('bind', {}).get('port', 953) }}
{%- if control.get('allow') %}
allow {
@ -151,7 +151,7 @@ controls {
{%- if salt['pillar.get']('bind:statistics', False) %}
statistics-channels {
{%- for name, channel in salt['pillar.get']('bind:statistics').iteritems() if channel.get('enabled', True) %}
{%- for name, channel in salt['pillar.get']('bind:statistics')|dictsort if channel.get('enabled', True) %}
inet {{ channel.get('bind', {}).get('address', '127.0.0.1') }} port {{ channel.get('bind', {}).get('port', 953) }}
{%- if channel.get('allow') %}
allow {

View file

@ -28,11 +28,11 @@ $TTL {{ soa['ttl'] }}
{% if include %}
$INCLUDE {{ include }}
{% else %}
{% for type, rrs in records.iteritems() %}
{% for type, rrs in records|dictsort %}
;
; {{ type }} RRs
;
{%- for host, data in rrs.iteritems() %}
{%- for host, data in rrs|dictsort %}
{%- if data is number or data is string %}
{{ host }} {{ type }} {{ data }}
{%- elif data is iterable %}