From 68f8acbaf44379173faaa8aa7cae6ee40024df88 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 16 Apr 2022 12:13:06 +0200 Subject: dns: T4353: fix Jinja2 linting errors --- data/templates/dns-forwarding/recursor.conf.j2 | 42 ++++++++++++++++++++++ data/templates/dns-forwarding/recursor.conf.lua.j2 | 9 +++++ .../dns-forwarding/recursor.conf.lua.tmpl | 9 ----- data/templates/dns-forwarding/recursor.conf.tmpl | 41 --------------------- .../dns-forwarding/recursor.forward-zones.conf.j2 | 29 +++++++++++++++ .../recursor.forward-zones.conf.tmpl | 28 --------------- .../recursor.vyos-hostsd.conf.lua.j2 | 30 ++++++++++++++++ .../recursor.vyos-hostsd.conf.lua.tmpl | 30 ---------------- .../templates/dns-forwarding/recursor.zone.conf.j2 | 6 ++++ .../dns-forwarding/recursor.zone.conf.tmpl | 7 ---- 10 files changed, 116 insertions(+), 115 deletions(-) create mode 100644 data/templates/dns-forwarding/recursor.conf.j2 create mode 100644 data/templates/dns-forwarding/recursor.conf.lua.j2 delete mode 100644 data/templates/dns-forwarding/recursor.conf.lua.tmpl delete mode 100644 data/templates/dns-forwarding/recursor.conf.tmpl create mode 100644 data/templates/dns-forwarding/recursor.forward-zones.conf.j2 delete mode 100644 data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl create mode 100644 data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.j2 delete mode 100644 data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl create mode 100644 data/templates/dns-forwarding/recursor.zone.conf.j2 delete mode 100644 data/templates/dns-forwarding/recursor.zone.conf.tmpl (limited to 'data/templates/dns-forwarding') diff --git a/data/templates/dns-forwarding/recursor.conf.j2 b/data/templates/dns-forwarding/recursor.conf.j2 new file mode 100644 index 000000000..c1950e1bc --- /dev/null +++ b/data/templates/dns-forwarding/recursor.conf.j2 @@ -0,0 +1,42 @@ +{# j2lint: disable=single-statement-per-line #} +### Autogenerated by dns_forwarding.py ### + +# XXX: pdns recursor doesn't like whitespace near entry separators, +# especially in the semicolon-separated lists of name servers. +# Please be careful if you edit the template. + +# Non-configurable defaults +daemon=yes +threads=1 +allow-from={{ allow_from | join(',') }} +log-common-errors=yes +non-local-bind=yes +query-local-address={{ source_address | join(',') }} +lua-config-file=recursor.conf.lua + +# cache-size +max-cache-entries={{ cache_size }} + +# negative TTL for NXDOMAIN +max-negative-ttl={{ negative_ttl }} + +# timeout +network-timeout={{ timeout }} + +# ignore-hosts-file +export-etc-hosts={{ 'no' if ignore_hosts_file is vyos_defined else 'yes' }} + +# listen-address +local-address={{ listen_address | join(',') }} + +# dnssec +dnssec={{ dnssec }} + +# serve rfc1918 records +serve-rfc1918={{ 'no' if no_serve_rfc1918 is vyos_defined else 'yes' }} + +# zones +auth-zones={% for z in authoritative_zones %}{{ z.name }}={{ z.file }}{{- "," if not loop.last -}}{% endfor %} + +forward-zones-file=recursor.forward-zones.conf + diff --git a/data/templates/dns-forwarding/recursor.conf.lua.j2 b/data/templates/dns-forwarding/recursor.conf.lua.j2 new file mode 100644 index 000000000..e2506238d --- /dev/null +++ b/data/templates/dns-forwarding/recursor.conf.lua.j2 @@ -0,0 +1,9 @@ +-- Autogenerated by VyOS (dns_forwarding.py) -- +-- Do not edit, your changes will get overwritten -- + +-- Load DNSSEC root keys from dns-root-data package. +dofile("/usr/share/pdns-recursor/lua-config/rootkeys.lua") + +-- Load lua from vyos-hostsd -- +dofile("recursor.vyos-hostsd.conf.lua") + diff --git a/data/templates/dns-forwarding/recursor.conf.lua.tmpl b/data/templates/dns-forwarding/recursor.conf.lua.tmpl deleted file mode 100644 index e2506238d..000000000 --- a/data/templates/dns-forwarding/recursor.conf.lua.tmpl +++ /dev/null @@ -1,9 +0,0 @@ --- Autogenerated by VyOS (dns_forwarding.py) -- --- Do not edit, your changes will get overwritten -- - --- Load DNSSEC root keys from dns-root-data package. -dofile("/usr/share/pdns-recursor/lua-config/rootkeys.lua") - --- Load lua from vyos-hostsd -- -dofile("recursor.vyos-hostsd.conf.lua") - diff --git a/data/templates/dns-forwarding/recursor.conf.tmpl b/data/templates/dns-forwarding/recursor.conf.tmpl deleted file mode 100644 index 385bef94b..000000000 --- a/data/templates/dns-forwarding/recursor.conf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -### Autogenerated by dns_forwarding.py ### - -# XXX: pdns recursor doesn't like whitespace near entry separators, -# especially in the semicolon-separated lists of name servers. -# Please be careful if you edit the template. - -# Non-configurable defaults -daemon=yes -threads=1 -allow-from={{ allow_from | join(',') }} -log-common-errors=yes -non-local-bind=yes -query-local-address={{ source_address | join(',') }} -lua-config-file=recursor.conf.lua - -# cache-size -max-cache-entries={{ cache_size }} - -# negative TTL for NXDOMAIN -max-negative-ttl={{ negative_ttl }} - -# timeout -network-timeout={{ timeout }} - -# ignore-hosts-file -export-etc-hosts={{ 'no' if ignore_hosts_file is vyos_defined else 'yes' }} - -# listen-address -local-address={{ listen_address | join(',') }} - -# dnssec -dnssec={{ dnssec }} - -# serve rfc1918 records -serve-rfc1918={{ 'no' if no_serve_rfc1918 is vyos_defined else 'yes' }} - -# zones -auth-zones={% for z in authoritative_zones %}{{ z.name }}={{ z.file }}{{- "," if not loop.last -}}{% endfor %} - -forward-zones-file=recursor.forward-zones.conf - diff --git a/data/templates/dns-forwarding/recursor.forward-zones.conf.j2 b/data/templates/dns-forwarding/recursor.forward-zones.conf.j2 new file mode 100644 index 000000000..de3269e47 --- /dev/null +++ b/data/templates/dns-forwarding/recursor.forward-zones.conf.j2 @@ -0,0 +1,29 @@ +{# j2lint: disable=operator-enclosed-by-spaces #} +# Autogenerated by VyOS (vyos-hostsd) +# Do not edit, your changes will get overwritten + +# dot zone (catch-all): '+' indicates recursion is desired +# (same as forward-zones-recurse) +{# the code below ensures the order of nameservers is determined first by #} +{# the order of tags, then by the order of nameservers within that tag #} +{% set n = namespace(dot_zone_ns='') %} +{% for tag in name_server_tags_recursor %} +{% set ns = '' %} +{% if tag in name_servers %} +{% set ns = ns + name_servers[tag] | join(', ') %} +{% set n.dot_zone_ns = (n.dot_zone_ns, ns) | join(', ') if n.dot_zone_ns != '' else ns %} +{% endif %} +# {{ tag }}: {{ ns }} +{% endfor %} + +{% if n.dot_zone_ns %} ++.={{ n.dot_zone_ns }} +{% endif %} + +{% if forward_zones is vyos_defined %} +# zones added via 'service dns forwarding domain' +{% for zone, zonedata in forward_zones.items() %} +{{ "+" if zonedata.recursion_desired is vyos_defined }}{{ zone | replace('_', '-') }}={{ zonedata.server | join(', ') }} +{% endfor %} +{% endif %} + diff --git a/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl b/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl deleted file mode 100644 index 96cbc35a5..000000000 --- a/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -# Autogenerated by VyOS (vyos-hostsd) -# Do not edit, your changes will get overwritten - -# dot zone (catch-all): '+' indicates recursion is desired -# (same as forward-zones-recurse) -{# the code below ensures the order of nameservers is determined first by #} -{# the order of tags, then by the order of nameservers within that tag #} -{% set n = namespace(dot_zone_ns='') %} -{% for tag in name_server_tags_recursor %} -{% set ns = '' %} -{% if tag in name_servers %} -{% set ns = ns + name_servers[tag]|join(', ') %} -{% set n.dot_zone_ns = (n.dot_zone_ns, ns)|join(', ') if n.dot_zone_ns != '' else ns %} -{% endif %} -# {{ tag }}: {{ ns }} -{% endfor %} - -{% if n.dot_zone_ns %} -+.={{ n.dot_zone_ns }} -{% endif %} - -{% if forward_zones is vyos_defined %} -# zones added via 'service dns forwarding domain' -{% for zone, zonedata in forward_zones.items() %} -{{ "+" if zonedata.recursion_desired is vyos_defined }}{{ zone | replace('_', '-') }}={{ zonedata.server | join(', ') }} -{% endfor %} -{% endif %} - diff --git a/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.j2 b/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.j2 new file mode 100644 index 000000000..987c7de1f --- /dev/null +++ b/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.j2 @@ -0,0 +1,30 @@ +-- Autogenerated by VyOS (vyos-hostsd) -- +-- Do not edit, your changes will get overwritten -- + +{% if hosts %} +-- from 'system static-host-mapping' and DHCP server +{% for tag, taghosts in hosts.items() %} +{% for host, hostprops in taghosts.items() %} +addNTA("{{ host }}.", "{{ tag }}") +{% for a in hostprops['aliases'] %} +addNTA("{{ a }}.", "{{ tag }} alias") +{% endfor %} +{% endfor %} +{% endfor %} +{% endif %} + +{% if forward_zones is vyos_defined %} +-- from 'service dns forwarding domain' +{% for zone, zonedata in forward_zones.items() %} +{% if zonedata.addnta is vyos_defined %} +addNTA("{{ zone }}", "static") +{% endif %} +{% endfor %} +{% endif %} + +{% if authoritative_zones is vyos_defined %} +-- from 'service dns forwarding authoritative-domain' +{% for zone in authoritative_zones %} +addNTA("{{ zone }}", "static") +{% endfor %} +{% endif %} diff --git a/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl b/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl deleted file mode 100644 index 04fb72121..000000000 --- a/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl +++ /dev/null @@ -1,30 +0,0 @@ --- Autogenerated by VyOS (vyos-hostsd) -- --- Do not edit, your changes will get overwritten -- - -{% if hosts %} --- from 'system static-host-mapping' and DHCP server -{% for tag, taghosts in hosts.items() %} -{% for host, hostprops in taghosts.items() %} -addNTA("{{ host }}.", "{{ tag }}") -{% for a in hostprops['aliases'] %} -addNTA("{{ a }}.", "{{ tag }} alias") -{% endfor %} -{% endfor %} -{% endfor %} -{% endif %} - -{% if forward_zones is vyos_defined %} --- from 'service dns forwarding domain' -{% for zone, zonedata in forward_zones.items() %} -{% if zonedata.addnta is vyos_defined %} -addNTA("{{ zone }}", "static") -{% endif %} -{% endfor %} -{% endif %} - -{% if authoritative_zones is vyos_defined %} --- from 'service dns forwarding authoritative-domain' -{% for zone in authoritative_zones %} -addNTA("{{ zone }}", "static") -{% endfor %} -{% endif %} diff --git a/data/templates/dns-forwarding/recursor.zone.conf.j2 b/data/templates/dns-forwarding/recursor.zone.conf.j2 new file mode 100644 index 000000000..25193c2ec --- /dev/null +++ b/data/templates/dns-forwarding/recursor.zone.conf.j2 @@ -0,0 +1,6 @@ +; +; Autogenerated by dns_forwarding.py +; +{% for r in records %} +{{ r.name }} {{ r.ttl }} {{ r.type }} {{ r.value }} +{% endfor %} diff --git a/data/templates/dns-forwarding/recursor.zone.conf.tmpl b/data/templates/dns-forwarding/recursor.zone.conf.tmpl deleted file mode 100644 index 758871bef..000000000 --- a/data/templates/dns-forwarding/recursor.zone.conf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -; -; Autogenerated by dns_forwarding.py -; -; -{% for r in records %} -{{ r.name }} {{ r.ttl }} {{ r.type }} {{ r.value }} -{% endfor %} -- cgit v1.2.3