Skip to content

Commit

Permalink
Merge pull request #65 from lsst-it/leapsectz
Browse files Browse the repository at this point in the history
Add `leapsectz` option config option
  • Loading branch information
aboe76 authored Jan 30, 2020
2 parents 76db1bb + ffa2088 commit 8604e8e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions spec/classes/chrony_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand All @@ -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$}) }
Expand All @@ -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$}) }
Expand Down
5 changes: 5 additions & 0 deletions templates/chrony.conf.debian.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
5 changes: 5 additions & 0 deletions templates/chrony.conf.redhat.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down

0 comments on commit 8604e8e

Please sign in to comment.