Skip to content

(MODULES-8098) - Add logconfig option to config file #491

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

Merged
merged 2 commits into from
Nov 29, 2018
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
12 changes: 12 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Data type: `Boolean`

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

##### `burst`

Data type: `Boolean`

When the server is reachable, send a burst of eight packets instead of the usual one. Default value: false.

##### `config`

Data type: `Stdlib::Absolutepath`
Expand Down Expand Up @@ -180,6 +186,12 @@ Data type: `Optional[Stdlib::Absolutepath]`

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

##### `logconfig`

Data type: `Optional[String]`

Specifies the logconfig for NTP to use. Default value: ' '.

##### `minpoll`

Data type: `Optional[Ntp::Poll_interval]`
Expand Down
1 change: 1 addition & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ntp::keys_trusted: []
ntp::keys: []
ntp::leapfile: ~
ntp::logfile: ~
ntp::logconfig: ~
ntp::ntpsigndsocket: ~
ntp::maxpoll: ~
ntp::minpoll: ~
Expand Down
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

if $ntp::disable_dhclient {
augeas { 'disable ntp-servers in dhclient.conf':
context => '/files/etc/dhcp/dhclient.conf',
context => '/etc/dhcp/dhclient.conf',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eimlav Why was this changed? Maybe you meant to use incl instead of context? As it is, it seems to be currently broken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes => 'rm request/*[.="ntp-servers"]',
}

Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
# @param logfile
# Specifies a log file for NTP to use instead of syslog. Default value: ' '.
#
# @param logconfig
# Specifies the logconfig for NTP to use. Default value: ' '.
#
# @param minpoll
# Sets Puppet to non-standard minimal poll interval of upstream servers.
# Values: 3 to 16. Default: undef.
Expand Down Expand Up @@ -226,6 +229,7 @@
Stdlib::Absolutepath $driftfile,
Optional[Stdlib::Absolutepath] $leapfile,
Optional[Stdlib::Absolutepath] $logfile,
Optional[String] $logconfig,
Boolean $iburst_enable,
Array[String] $keys,
Boolean $keys_enable,
Expand Down
27 changes: 27 additions & 0 deletions spec/classes/ntp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,33 @@
end
end

describe 'with parameter logconfig' do
context 'when set to true' do
let(:params) do
{
servers: ['a', 'b', 'c', 'd'],
logconfig: '=syncall +peerinfo',
}
end

it 'contains logconfig setting' do
is_expected.to contain_file('/etc/ntp.conf').with('content' => %r{^logconfig =syncall \+peerinfo\n})
end
end

context 'when set to false' do
let(:params) do
{
servers: ['a', 'b', 'c', 'd'],
}
end

it 'does not contain a logconfig line' do
is_expected.not_to contain_file('/etc/ntp.conf').with('content' => %r{logconfig })
end
end
end

describe 'with parameter ntpsigndsocket' do
context 'when set to true' do
let(:params) do
Expand Down
6 changes: 6 additions & 0 deletions templates/ntp.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ driftfile <%= $ntp::driftfile %>
logfile <%= $ntp::logfile %>
<% } -%>
<%# -%>
<% if $ntp::logconfig {-%>

# Logconfig
logconfig <%= $ntp::logconfig %>
<% } -%>
<%# -%>
<% if $ntp::ntpsigndsocket {-%>

# Enable signed packets
Expand Down