From aa4cb50bdf9932ff54776ee222f3caecb4a26b28 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 10 Apr 2022 10:08:05 +0200 Subject: dns: T4333: migrate to new vyos_defined Jinja2 test --- data/templates/dynamic-dns/ddclient.conf.tmpl | 46 ++++++++++++++------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'data/templates/dynamic-dns/ddclient.conf.tmpl') 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 %} -- cgit v1.2.3