summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-10 10:08:05 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-10 10:08:05 +0200
commitaa4cb50bdf9932ff54776ee222f3caecb4a26b28 (patch)
tree9777a998d7c5324d7bd00acf8484f059f95109d7 /data
parent17586e0f0698d65f4910ebb480997d768118311c (diff)
downloadvyos-1x-aa4cb50bdf9932ff54776ee222f3caecb4a26b28.tar.gz
vyos-1x-aa4cb50bdf9932ff54776ee222f3caecb4a26b28.zip
dns: T4333: migrate to new vyos_defined Jinja2 test
Diffstat (limited to 'data')
-rw-r--r--data/templates/dns-forwarding/recursor.conf.tmpl4
-rw-r--r--data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl4
-rw-r--r--data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl6
-rw-r--r--data/templates/dynamic-dns/ddclient.conf.tmpl46
4 files changed, 31 insertions, 29 deletions
diff --git a/data/templates/dns-forwarding/recursor.conf.tmpl b/data/templates/dns-forwarding/recursor.conf.tmpl
index d4ec80a3a..385bef94b 100644
--- a/data/templates/dns-forwarding/recursor.conf.tmpl
+++ b/data/templates/dns-forwarding/recursor.conf.tmpl
@@ -23,7 +23,7 @@ max-negative-ttl={{ negative_ttl }}
network-timeout={{ timeout }}
# ignore-hosts-file
-export-etc-hosts={{ 'no' if ignore_hosts_file is defined else 'yes' }}
+export-etc-hosts={{ 'no' if ignore_hosts_file is vyos_defined else 'yes' }}
# listen-address
local-address={{ listen_address | join(',') }}
@@ -32,7 +32,7 @@ local-address={{ listen_address | join(',') }}
dnssec={{ dnssec }}
# serve rfc1918 records
-serve-rfc1918={{ 'no' if no_serve_rfc1918 is defined else 'yes' }}
+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 %}
diff --git a/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl b/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl
index 3ab0c804d..96cbc35a5 100644
--- a/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl
+++ b/data/templates/dns-forwarding/recursor.forward-zones.conf.tmpl
@@ -19,10 +19,10 @@
+.={{ n.dot_zone_ns }}
{% endif %}
-{% if forward_zones is defined %}
+{% 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 defined }}{{ zone | replace('_', '-') }}={{ zonedata['server']|join(', ') }}
+{{ "+" 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.tmpl b/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl
index 7f29c387e..04fb72121 100644
--- a/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl
+++ b/data/templates/dns-forwarding/recursor.vyos-hostsd.conf.lua.tmpl
@@ -13,16 +13,16 @@ addNTA("{{ a }}.", "{{ tag }} alias")
{% endfor %}
{% endif %}
-{% if forward_zones is defined %}
+{% if forward_zones is vyos_defined %}
-- from 'service dns forwarding domain'
{% for zone, zonedata in forward_zones.items() %}
-{% if zonedata['addnta'] is defined %}
+{% if zonedata.addnta is vyos_defined %}
addNTA("{{ zone }}", "static")
{% endif %}
{% endfor %}
{% endif %}
-{% if authoritative_zones is defined %}
+{% if authoritative_zones is vyos_defined %}
-- from 'service dns forwarding authoritative-domain'
{% for zone in authoritative_zones %}
addNTA("{{ zone }}", "static")
diff --git a/data/templates/dynamic-dns/ddclient.conf.tmpl b/data/templates/dynamic-dns/ddclient.conf.tmpl
index 517e4bad4..ee55c9fa6 100644
--- a/data/templates/dynamic-dns/ddclient.conf.tmpl
+++ b/data/templates/dynamic-dns/ddclient.conf.tmpl
@@ -3,18 +3,19 @@ daemon=1m
syslog=yes
ssl=yes
-{% for iface in interface %}
+{% if interface is vyos_defined %}
+{% for iface, iface_config in interface.items() %}
# ddclient configuration for interface "{{ iface }}"
-{% if interface[iface].use_web is defined and interface[iface].use_web is not none %}
-{% set web_skip = ", web-skip='" + interface[iface].use_web.skip + "'" if interface[iface].use_web.skip is defined else '' %}
-use=web, web='{{ interface[iface].use_web.url }}'{{ web_skip }}
-{% else %}
-{{ 'usev6=if' if interface[iface].ipv6_enable is defined else 'use=if' }}, if={{ iface }}
-{% endif %}
+{% if iface_config.use_web is vyos_defined %}
+{% set web_skip = ", web-skip='" ~ iface_config.use_web.skip ~ "'" if iface_config.use_web.skip is vyos_defined else '' %}
+use=web, web='{{ iface_config.use_web.url }}'{{ web_skip }}
+{% else %}
+{{ 'usev6=if' if iface_config.ipv6_enable is vyos_defined else 'use=if' }}, if={{ iface }}
+{% endif %}
-{% if interface[iface].rfc2136 is defined and interface[iface].rfc2136 is not none %}
-{% for rfc2136, config in interface[iface].rfc2136.items() %}
-{% for dns_record in config.record if config.record is defined %}
+{% if iface_config.rfc2136 is vyos_defined %}
+{% for rfc2136, config in iface_config.rfc2136.items() %}
+{% for dns_record in config.record if config.record is vyos_defined %}
# RFC2136 dynamic DNS configuration for {{ rfc2136 }}, {{ config.zone }}, {{ dns_record }}
server={{ config.server }}
protocol=nsupdate
@@ -23,27 +24,28 @@ ttl={{ config.ttl }}
zone={{ config.zone }}
{{ dns_record }}
+{% endfor %}
{% endfor %}
-{% endfor %}
-{% endif %}
+{% endif %}
-{% if interface[iface].service is defined and interface[iface].service is not none %}
-{% for service, config in interface[iface].service.items() %}
-{% for dns_record in config.host_name %}
+{% if iface_config.service is vyos_defined %}
+{% for service, config in iface_config.service.items() %}
+{% for dns_record in config.host_name %}
# DynDNS provider configuration for {{ service }}, {{ dns_record }}
protocol={{ config.protocol }},
max-interval=28d,
login={{ config.login }},
password='{{ config.password }}',
-{% if config.server %}
+{% if config.server is vyos_defined %}
server={{ config.server }},
-{% endif %}
-{% if config.zone %}
+{% endif %}
+{% if config.zone is vyos_defined %}
zone={{ config.zone }},
-{% endif %}
+{% endif %}
{{ dns_record }}
+{% endfor %}
{% endfor %}
-{% endfor %}
-{% endif %}
-{% endfor %}
+{% endif %}
+{% endfor %}
+{% endif %}