Skip to content

Commit 572f4c1

Browse files
authored
Merge pull request #491 from eimlav/modules-8098
(MODULES-8098) - Add logconfig option to config file
2 parents 24f67be + c9d4269 commit 572f4c1

File tree

6 files changed

+51
-1
lines changed

6 files changed

+51
-1
lines changed

REFERENCE.md

+12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ Data type: `Boolean`
3939

4040
Enables reception of broadcast server messages to any local interface. Default value: false.
4141

42+
##### `burst`
43+
44+
Data type: `Boolean`
45+
46+
When the server is reachable, send a burst of eight packets instead of the usual one. Default value: false.
47+
4248
##### `config`
4349

4450
Data type: `Stdlib::Absolutepath`
@@ -180,6 +186,12 @@ Data type: `Optional[Stdlib::Absolutepath]`
180186

181187
Specifies a log file for NTP to use instead of syslog. Default value: ' '.
182188

189+
##### `logconfig`
190+
191+
Data type: `Optional[String]`
192+
193+
Specifies the logconfig for NTP to use. Default value: ' '.
194+
183195
##### `minpoll`
184196

185197
Data type: `Optional[Ntp::Poll_interval]`

data/common.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ntp::keys_trusted: []
2525
ntp::keys: []
2626
ntp::leapfile: ~
2727
ntp::logfile: ~
28+
ntp::logconfig: ~
2829
ntp::ntpsigndsocket: ~
2930
ntp::maxpoll: ~
3031
ntp::minpoll: ~

manifests/config.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090

9191
if $ntp::disable_dhclient {
9292
augeas { 'disable ntp-servers in dhclient.conf':
93-
context => '/files/etc/dhcp/dhclient.conf',
93+
context => '/etc/dhcp/dhclient.conf',
9494
changes => 'rm request/*[.="ntp-servers"]',
9595
}
9696

manifests/init.pp

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
# @param logfile
8484
# Specifies a log file for NTP to use instead of syslog. Default value: ' '.
8585
#
86+
# @param logconfig
87+
# Specifies the logconfig for NTP to use. Default value: ' '.
88+
#
8689
# @param minpoll
8790
# Sets Puppet to non-standard minimal poll interval of upstream servers.
8891
# Values: 3 to 16. Default: undef.
@@ -226,6 +229,7 @@
226229
Stdlib::Absolutepath $driftfile,
227230
Optional[Stdlib::Absolutepath] $leapfile,
228231
Optional[Stdlib::Absolutepath] $logfile,
232+
Optional[String] $logconfig,
229233
Boolean $iburst_enable,
230234
Array[String] $keys,
231235
Boolean $keys_enable,

spec/classes/ntp_spec.rb

+27
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,33 @@
800800
end
801801
end
802802

803+
describe 'with parameter logconfig' do
804+
context 'when set to true' do
805+
let(:params) do
806+
{
807+
servers: ['a', 'b', 'c', 'd'],
808+
logconfig: '=syncall +peerinfo',
809+
}
810+
end
811+
812+
it 'contains logconfig setting' do
813+
is_expected.to contain_file('/etc/ntp.conf').with('content' => %r{^logconfig =syncall \+peerinfo\n})
814+
end
815+
end
816+
817+
context 'when set to false' do
818+
let(:params) do
819+
{
820+
servers: ['a', 'b', 'c', 'd'],
821+
}
822+
end
823+
824+
it 'does not contain a logconfig line' do
825+
is_expected.not_to contain_file('/etc/ntp.conf').with('content' => %r{logconfig })
826+
end
827+
end
828+
end
829+
803830
describe 'with parameter ntpsigndsocket' do
804831
context 'when set to true' do
805832
let(:params) do

templates/ntp.conf.epp

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ driftfile <%= $ntp::driftfile %>
9090
logfile <%= $ntp::logfile %>
9191
<% } -%>
9292
<%# -%>
93+
<% if $ntp::logconfig {-%>
94+
95+
# Logconfig
96+
logconfig <%= $ntp::logconfig %>
97+
<% } -%>
98+
<%# -%>
9399
<% if $ntp::ntpsigndsocket {-%>
94100

95101
# Enable signed packets

0 commit comments

Comments
 (0)