From 24f136fe08fb28383be78016c97db236889f621d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 13 Apr 2022 22:52:36 +0200 Subject: ntp: T4333: migrate to new vyos_defined Jinja2 test --- data/templates/ntp/ntpd.conf.tmpl | 8 ++++---- data/templates/ntp/override.conf.tmpl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/templates/ntp/ntpd.conf.tmpl b/data/templates/ntp/ntpd.conf.tmpl index e7afcc16b..3123fdf19 100644 --- a/data/templates/ntp/ntpd.conf.tmpl +++ b/data/templates/ntp/ntpd.conf.tmpl @@ -15,17 +15,17 @@ restrict -6 ::1 # # Configurable section # -{% if server is defined and server is not none %} +{% if server is vyos_defined %} {% for server, config in server.items() %} {% set association = 'server' %} -{% if config.pool is defined %} +{% if config.pool is vyos_defined %} {% set association = 'pool' %} {% endif %} -{{ association }} {{ server | replace('_', '-') }} iburst {{ 'noselect' if config.noselect is defined }} {{ 'preempt' if config.preempt is defined }} {{ 'prefer' if config.prefer is defined }} +{{ association }} {{ server | replace('_', '-') }} iburst {{ 'noselect' if config.noselect is vyos_defined }} {{ 'preempt' if config.preempt is vyos_defined }} {{ 'prefer' if config.prefer is vyos_defined }} {% endfor %} {% endif %} -{% if allow_clients is defined and allow_clients.address is defined %} +{% if allow_clients.address is vyos_defined %} # Allowed clients configuration restrict default ignore {% for address in allow_clients.address %} diff --git a/data/templates/ntp/override.conf.tmpl b/data/templates/ntp/override.conf.tmpl index 28eb61b21..dbfdc4545 100644 --- a/data/templates/ntp/override.conf.tmpl +++ b/data/templates/ntp/override.conf.tmpl @@ -1,4 +1,4 @@ -{% set vrf_command = 'ip vrf exec ' + vrf + ' ' if vrf is defined else '' %} +{% set vrf_command = 'ip vrf exec ' ~ vrf ~ ' ' if vrf is vyos_defined else '' %} [Unit] StartLimitIntervalSec=0 ConditionPathExists={{config_file}} @@ -6,7 +6,7 @@ After=vyos-router.service [Service] ExecStart= -ExecStart={{vrf_command}}/usr/sbin/ntpd -g -p {{config_file | replace('.conf', '.pid') }} -c {{config_file}} -u ntp:ntp +ExecStart={{vrf_command}}/usr/sbin/ntpd -g -p {{ config_file | replace('.conf', '.pid') }} -c {{ config_file }} -u ntp:ntp PIDFile= PIDFile={{config_file | replace('.conf', '.pid') }} Restart=always -- cgit v1.2.3