From ffa20883a41d7177da0d09f259b52ca463b778d8 Mon Sep 17 00:00:00 2001 From: Adrien Thebo Date: Wed, 29 Jan 2020 11:36:25 -0300 Subject: [PATCH] Add `leapsectz` option config option --- manifests/config.pp | 1 + manifests/init.pp | 3 +++ spec/classes/chrony_spec.rb | 3 +++ templates/chrony.conf.debian.erb | 5 +++++ templates/chrony.conf.redhat.erb | 5 +++++ 5 files changed, 17 insertions(+) diff --git a/manifests/config.pp b/manifests/config.pp index 5b86f82..3c534ed 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -26,6 +26,7 @@ $pools = $chrony::pools, $port = $chrony::port, $leapsecmode = $chrony::leapsecmode, + $leapsectz = $chrony::leapsectz, $maxslewrate = $chrony::maxslewrate, $smoothtime = $chrony::smoothtime, $stratumweight = $chrony::stratumweight, diff --git a/manifests/init.pp b/manifests/init.pp index 1718c3a..1f97d45 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -156,6 +156,8 @@ # Force chrony to only use RAM & prevent swapping. # @param leapsecmode # Configures how to insert the leap second mode. +# @param leapsectz +# Specifies a timezone that chronyd can use to determine the offset between UTC and TAI. # @param maxslewrate # Maximum rate for chronyd to slew the time. Only float type values possible, for example: `maxslewrate 1000.0`. # @param clientlog @@ -209,6 +211,7 @@ String[1] $service_name = $chrony::params::service_name, Optional[String] $smoothtime = undef, Optional[Enum['system', 'step', 'slew', 'ignore']] $leapsecmode = undef, + Optional[String] $leapsectz = undef, Optional[Float] $maxslewrate = undef, Optional[Numeric] $stratumweight = undef, ) inherits chrony::params { diff --git a/spec/classes/chrony_spec.rb b/spec/classes/chrony_spec.rb index 4cca60c..1dc0eff 100644 --- a/spec/classes/chrony_spec.rb +++ b/spec/classes/chrony_spec.rb @@ -84,6 +84,7 @@ bindcmdaddress: ['10.0.0.1'], cmdacl: ['cmdallow 1.2.3.4', 'cmddeny 1.2.3', 'cmdallow all 1.2'], leapsecmode: 'slew', + leapsectz: 'right/UTC', maxslewrate: 1000.0, smoothtime: '400 0.001 leaponly', } @@ -107,6 +108,7 @@ when 'RedHat' context 'with some params passed in' do it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*leapsecmode slew$}) } + it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*leapsectz right/UTC$}) } it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*maxslewrate 1000\.0$}) } it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*smoothtime 400 0\.001 leaponly$}) } it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*port 123$}) } @@ -125,6 +127,7 @@ end when 'Debian' context 'with some params passed in' do + it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*leapsectz right/UTC$}) } it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*leapsecmode slew$}) } it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*maxslewrate 1000\.0$}) } it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*smoothtime 400 0\.001 leaponly$}) } diff --git a/templates/chrony.conf.debian.erb b/templates/chrony.conf.debian.erb index 78b4513..0c052a3 100644 --- a/templates/chrony.conf.debian.erb +++ b/templates/chrony.conf.debian.erb @@ -107,6 +107,11 @@ lock_all leapsecmode <%= @leapsecmode %> <% end -%> +# https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#leapsectz +<% if defined?(@leapsectz) %> +leapsectz <%= @leapsectz %> +<% end -%> + # https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#maxslewrate <% if defined?(@maxslewrate) %> maxslewrate <%= @maxslewrate %> diff --git a/templates/chrony.conf.redhat.erb b/templates/chrony.conf.redhat.erb index 78b4513..0c052a3 100644 --- a/templates/chrony.conf.redhat.erb +++ b/templates/chrony.conf.redhat.erb @@ -107,6 +107,11 @@ lock_all leapsecmode <%= @leapsecmode %> <% end -%> +# https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#leapsectz +<% if defined?(@leapsectz) %> +leapsectz <%= @leapsectz %> +<% end -%> + # https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#maxslewrate <% if defined?(@maxslewrate) %> maxslewrate <%= @maxslewrate %>