From bebf12fcf568a4b0e00703e3dcee371b894e174c Mon Sep 17 00:00:00 2001 From: Ben Crisp Date: Tue, 2 Mar 2021 01:43:47 +0000 Subject: [PATCH] fix: remove all uses of the dictsort filter --- bind/config.sls | 4 ++-- bind/files/arch/named.conf | 2 +- bind/files/debian/named.conf.key | 2 +- bind/files/debian/named.conf.options | 2 +- bind/files/debian/rndc.conf | 4 ++-- bind/files/freebsd/named.conf | 4 ++-- bind/files/gentoo/named.conf | 4 ++-- bind/files/named.conf.local.jinja | 14 +++++++------- bind/files/redhat/named.conf | 2 +- bind/files/suse/named.conf | 2 +- bind/files/zone.jinja | 4 ++-- bind/reverse_zone.jinja | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bind/config.sls b/bind/config.sls index a12349f8..fa0cccde 100644 --- a/bind/config.sls +++ b/bind/config.sls @@ -203,9 +203,9 @@ bind_rndc_client_config: {%- set views = {False: salt['pillar.get']('bind', {})} %}{# process non-view zones in the same loop #} {%- do views.update(salt['pillar.get']('bind:configured_views', {})) %} -{%- for view, view_data in views|dictsort %} +{%- for view, view_data in views.items() %} {%- set dash_view = '-' + view if view else '' %} -{%- for zone, zone_data in view_data.get('configured_zones', {})|dictsort -%} +{%- for zone, zone_data in view_data.get('configured_zones', {}).items() -%} {%- if 'file' in zone_data %} {%- set file = zone_data.file %} {%- set zone = file|replace(".txt", "") %} diff --git a/bind/files/arch/named.conf b/bind/files/arch/named.conf index 145974a6..12af7577 100644 --- a/bind/files/arch/named.conf +++ b/bind/files/arch/named.conf @@ -11,7 +11,7 @@ options { // listen-on { none; }; {#- Allow inclusion of arbitrary statements #} - {%- for statement, value in salt['pillar.get']('bind:config:options', {})|dictsort -%} + {%- for statement, value in salt['pillar.get']('bind:config:options', {}).items() -%} {%- if value is iterable and value is not string %} {{ statement }} { {%- for item in value %} diff --git a/bind/files/debian/named.conf.key b/bind/files/debian/named.conf.key index cb75e7e4..809bb253 100644 --- a/bind/files/debian/named.conf.key +++ b/bind/files/debian/named.conf.key @@ -3,7 +3,7 @@ // Do any local configuration here // -{% for key,args in salt['pillar.get']('bind:keys', {})|dictsort -%} +{% for key,args in salt['pillar.get']('bind:keys', {}).items() -%} key "{{ key }}" { algorithm {{ args['algorithm'] | default('HMAC-MD5.SIG-ALG.REG.INT') }}; secret "{{ args['secret'] }}"; diff --git a/bind/files/debian/named.conf.options b/bind/files/debian/named.conf.options index ecffa893..df31290c 100644 --- a/bind/files/debian/named.conf.options +++ b/bind/files/debian/named.conf.options @@ -27,7 +27,7 @@ options { {%- endif -%} {#- Allow inclusion of arbitrary statements #} -{%- for statement, value in salt['pillar.get']('bind:config:options', {})|dictsort -%} +{%- for statement, value in salt['pillar.get']('bind:config:options', {}).items() -%} {%- if value is iterable and value is not string %} {{ statement }} { {%- for item in value %} diff --git a/bind/files/debian/rndc.conf b/bind/files/debian/rndc.conf index 52a7d4d3..3c12500d 100644 --- a/bind/files/debian/rndc.conf +++ b/bind/files/debian/rndc.conf @@ -5,13 +5,13 @@ options { }; -{% for key,args in salt['pillar.get']('bind:rndc_client:server', {})|dictsort -%} +{% for key,args in salt['pillar.get']('bind:rndc_client:server', {}).items() -%} server "{{ key }}" { key {{ args['key'] }}; }; {% endfor %} -{% for key,args in salt['pillar.get']('bind:keys', {})|dictsort -%} +{% for key,args in salt['pillar.get']('bind:keys', {}).items() -%} key "{{ key }}" { algorithm {{ args['algorithm'] | default('HMAC-MD5.SIG-ALG.REG.INT') }}; secret "{{ args['secret'] }}"; diff --git a/bind/files/freebsd/named.conf b/bind/files/freebsd/named.conf index 19db5aa2..8f1d7e6a 100644 --- a/bind/files/freebsd/named.conf +++ b/bind/files/freebsd/named.conf @@ -71,7 +71,7 @@ options { {%- endif -%} {#- Allow inclusion of arbitrary statements #} -{%- for statement, value in salt['pillar.get']('bind:config:options', {})|dictsort -%} +{%- for statement, value in salt['pillar.get']('bind:config:options', {}).items() -%} {%- if value is iterable and value is not string %} {{ statement }} { {%- for item in value %} @@ -379,7 +379,7 @@ zone "1.168.192.in-addr.arpa" { include "{{ map.local_config }}"; {%- if 'keys' in salt['pillar.get']('bind') %} -{% for key,args in salt['pillar.get']('bind:keys', {})|dictsort -%} +{% for key,args in salt['pillar.get']('bind:keys', {}).items() -%} key "{{ key }}" { algorithm {{ args['algorithm'] | default('HMAC-MD5.SIG-ALG.REG.INT') }}; secret "{{ args['secret'] }}"; diff --git a/bind/files/gentoo/named.conf b/bind/files/gentoo/named.conf index 4a2df8e3..7d95a059 100644 --- a/bind/files/gentoo/named.conf +++ b/bind/files/gentoo/named.conf @@ -22,7 +22,7 @@ options { listen-on { 127.0.0.1; }; -{%- for statement, value in salt['pillar.get']('bind:config:options', {})|dictsort -%} +{%- for statement, value in salt['pillar.get']('bind:config:options', {}).items() -%} {%- if value is iterable and value is not string %} {{ statement }} { {%- for item in value %} @@ -42,7 +42,7 @@ include "{{ incl }}"; {%- if salt['pillar.get']('bind:controls', False) %} controls { - {%- for name, control in salt['pillar.get']('bind:controls')|dictsort if control.get('enabled', True) %} + {%- for name, control in salt['pillar.get']('bind:controls').items() 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 { diff --git a/bind/files/named.conf.local.jinja b/bind/files/named.conf.local.jinja index 1176c1f5..02897399 100644 --- a/bind/files/named.conf.local.jinja +++ b/bind/files/named.conf.local.jinja @@ -7,7 +7,7 @@ // organization //include "/etc/bind/zones.rfc1918"; -{% for name, data in salt['pillar.get']('bind:configured_acls', {})|dictsort %} +{% for name, data in salt['pillar.get']('bind:configured_acls', {}).items() %} acl {{ name }} { {%- for d in data %} {{ d }}; @@ -15,7 +15,7 @@ acl {{ name }} { }; {%- endfor %} -{%- for name, data in salt['pillar.get']('bind:configured_masters', {})|dictsort %} +{%- for name, data in salt['pillar.get']('bind:configured_masters', {}).items() %} masters {{ name }} { {%- for d in data %} {{ d }}; @@ -93,7 +93,7 @@ zone "{{ key }}" { include "{{ map.default_zones_config }}"; {%- endif %} -{% for key, args in salt['pillar.get']('bind:configured_zones', {})|dictsort -%} +{% for key, args in salt['pillar.get']('bind:configured_zones', {}).items() -%} {%- if salt['pillar.get']("bind:configured_zones:" + key + ":file") -%} {%- set file = salt['pillar.get']("bind:configured_zones:" + key + ":file") %} {% else %} @@ -108,7 +108,7 @@ include "{{ map.default_zones_config }}"; {{ zone(key, args, file, masters) }} {% endfor %} -{%- for view, view_data in salt['pillar.get']('bind:configured_views', {})|dictsort %} +{%- for view, view_data in salt['pillar.get']('bind:configured_views', {}).items() %} view {{ view }} { {%- if view == 'default' %} @@ -120,7 +120,7 @@ view {{ view }} { {%- endfor %} }; -{%- for key, args in view_data.get('configured_zones', {})|dictsort -%} +{%- for key, args in view_data.get('configured_zones', {}).items() -%} {%- if 'file' in args %} {%- set file = args.file %} {%- else %} @@ -148,7 +148,7 @@ logging { {%- if salt['pillar.get']('bind:controls', False) %} controls { - {%- for name, control in salt['pillar.get']('bind:controls')|dictsort if control.get('enabled', True) %} + {%- for name, control in salt['pillar.get']('bind:controls').items() 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 { @@ -170,7 +170,7 @@ controls { {%- if salt['pillar.get']('bind:statistics', False) %} statistics-channels { - {%- for name, channel in salt['pillar.get']('bind:statistics')|dictsort if channel.get('enabled', True) %} + {%- for name, channel in salt['pillar.get']('bind:statistics').items() 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 { diff --git a/bind/files/redhat/named.conf b/bind/files/redhat/named.conf index 6a04da1c..c4ac3740 100644 --- a/bind/files/redhat/named.conf +++ b/bind/files/redhat/named.conf @@ -14,7 +14,7 @@ options { memstatistics-file "{{ map.get('named_directory') }}/data/named_mem_stats.txt"; {#- Allow inclusion of arbitrary statements #} -{%- for statement, value in salt['pillar.get']('bind:config:options', map.get('options', {}))|dictsort -%} +{%- for statement, value in salt['pillar.get']('bind:config:options', map.get('options', {})).items() -%} {%- if value is iterable and value is not string %} {{ statement }} { {%- for item in value %} diff --git a/bind/files/suse/named.conf b/bind/files/suse/named.conf index c6eafac9..ffc1b575 100644 --- a/bind/files/suse/named.conf +++ b/bind/files/suse/named.conf @@ -99,7 +99,7 @@ options { {% endif %} {#- Allow inclusion of arbitrary statements #} -{%- for statement, value in salt['pillar.get']('bind:config:options', map.get('options', {}))|dictsort -%} +{%- for statement, value in salt['pillar.get']('bind:config:options', map.get('options', {})).items() -%} {%- if value is iterable and value is not string %} {{ statement }} { {%- for item in value %} diff --git a/bind/files/zone.jinja b/bind/files/zone.jinja index 3f1f2f81..54619338 100644 --- a/bind/files/zone.jinja +++ b/bind/files/zone.jinja @@ -28,11 +28,11 @@ $TTL {{ soa['ttl'] }} {% if include %} $INCLUDE {{ include }} {% else %} -{% for type, rrs in records|dictsort %} +{% for type, rrs in records.items() %} ; ; {{ type }} RRs ; -{%- for host, data in rrs|dictsort %} +{%- for host, data in rrs.items() %} {%- if data is number or data is string %} {{ host }} {{ type }} {{ data }} {%- elif data is iterable %} diff --git a/bind/reverse_zone.jinja b/bind/reverse_zone.jinja index 23e55bfc..91b2bb64 100644 --- a/bind/reverse_zone.jinja +++ b/bind/reverse_zone.jinja @@ -5,7 +5,7 @@ {% set for_zones = available_zones.keys() if for_zones|length == 1 and for_zones[0] == 'any' else for_zones %} {%- for zone in for_zones %} {%- set A_records = available_zones.get(zone, {}).get('records', {}).get('A', {}) %} -{%- for name, addr_list in A_records|dictsort %} +{%- for name, addr_list in A_records.items() %} {%- set addr_list = [ addr_list ] if addr_list is string or addr_list is number else addr_list %} {%- for addr in addr_list %} {%- if salt['network.ip_in_subnet'](addr, net) %}