Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sched_priority and logbanner options. #148

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
# When not set, chronyd's default will be used, which since version 2.0 of chrony, is 0.001 seconds.
# @param log_options
# Specify which information is to be logged.
# @param logbanner
# Specify how often the log banner is placed in the logfile.
# @param package_ensure
# This can be set to 'present' or 'latest' or a specific version to choose the
# chrony package to be installed.
Expand Down Expand Up @@ -184,6 +186,8 @@
# Specify the time limit for triggering events.
# @param lock_all
# Force chrony to only use RAM & prevent swapping.
# @param sched_priority
# Set the CPU thread scheduler, this value is OS specific.
# @param leapsecmode
# Configures how to insert the leap second mode.
# @param leapsectz
Expand Down Expand Up @@ -251,6 +255,7 @@
Stdlib::Unixpath $driftfile = '/var/lib/chrony/drift',
Variant[Boolean[false],Integer[1,15]] $local_stratum = 10,
Optional[String[1]] $log_options = undef,
Optional[Integer[0]] $logbanner = undef,
String[1] $package_ensure = 'present',
String[1] $package_name = 'chrony',
Optional[String] $package_source = undef,
Expand All @@ -270,6 +275,7 @@
Optional[String[1]] $mailonchange = undef,
Float $threshold = 0.5,
Boolean $lock_all = false,
Optional[Integer[0,100]] $sched_priority = undef,
Optional[Stdlib::Port] $port = undef,
Boolean $clientlog = false,
Optional[Integer] $clientloglimit = undef,
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/chrony_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
cmdacl: ['cmdallow 1.2.3.4', 'cmddeny 1.2.3', 'cmdallow all 1.2'],
leapsecmode: 'slew',
leapsectz: 'right/UTC',
log_options: 'statistics refclocks',
logbanner: 40,
maxdistance: 16.0,
maxslewrate: 1000.0,
maxupdateskew: 1000.0,
Expand All @@ -160,6 +162,7 @@
hwtimestamps: ['eth0'],
driftfile: '/var/tmp/chrony.drift',
rtcsync: false,
sched_priority: 1,
dumpdir: '/var/tmp',
ntpsigndsocket: '/var/lib/samba/ntp_signd/socket',
ntsserverkey: '/tmp/cert.key',
Expand Down Expand Up @@ -205,6 +208,9 @@
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*ntsrotate 8$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*confdir /tmp/chroconf$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*sourcedir /tmp/chrosources$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*log statistics refclocks$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*logbanner 40$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*sched_priority 1$}) }
end
when 'RedHat'
context 'with some params passed in' do
Expand Down Expand Up @@ -245,6 +251,9 @@
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*ntsrotate 8$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*confdir /tmp/chroconf$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*sourcedir /tmp/chrosources$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*log statistics refclocks$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*logbanner 40$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*sched_priority 1$}) }
end
when 'Debian', 'Gentoo'
context 'with some params passed in' do
Expand Down Expand Up @@ -285,6 +294,9 @@
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*ntsrotate 8$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*confdir /tmp/chroconf$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*sourcedir /tmp/chrosources$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*log statistics refclocks$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*logbanner 40$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*sched_priority 1$}) }
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions templates/chrony.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ mailonchange <%= $chrony::mailonchange %> <%= $chrony::threshold %>
<% } -%>

logdir /var/log/chrony
<% if $chrony::logbanner { -%>
logbanner <%= $chrony::logbanner %>
<% } -%>
<% if $chrony::log_options { -%>
log <%= $chrony::log_options %>
<% } -%>
Expand All @@ -141,6 +144,9 @@ refclock <%= $driver.flatten.join(' ') %>
# Lock chrony to RAM.
lock_all
<% } -%>
<% if $chrony::sched_priority { -%>
sched_priority <%= $chrony::sched_priority %>
<% } -%>
<% if $chrony::leapsecmode { -%>

# https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#leapsecmode
Expand Down