Skip to content

Commit

Permalink
Merge pull request #442 from ASCIIDuck/master
Browse files Browse the repository at this point in the history
MODULES-6402: ntp: support xntpd's slewalways
  • Loading branch information
hunner committed Jan 18, 2018
2 parents 9f06f92 + 3afb29f commit 0c3f1e0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -501,6 +501,15 @@ Which service provider to use for NTP.

Default value: `undef`.

#### `slewalways`

Data type: Enum['no','yes'].

xntpd setting to disable stepping behavior and always slew the clock to handle adjustments.
Only relevant on platforms that run xntpd, like AIX, and should be left `undef` on other platforms.

Default value: varies by operating system.

#### `statistics`

Data type: Array.
Expand Down
1 change: 1 addition & 0 deletions data/AIX.yaml
Expand Up @@ -6,3 +6,4 @@ ntp::restrict:
- 'default nomodify notrap nopeer noquery'
- '127.0.0.1'
ntp::service_name: 'xntpd'
ntp::slewalways: 'no'
1 change: 1 addition & 0 deletions data/common.yaml
Expand Up @@ -45,6 +45,7 @@ ntp::service_ensure: running
ntp::service_manage: true
ntp::service_name: ntpd
ntp::service_provider: ~
ntp::slewalways: ~
ntp::statistics: []
ntp::statsdir: '/var/log/ntpstats'
ntp::stepout: ~
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Expand Up @@ -146,6 +146,10 @@
# @param service_provider
# Which service provider to use for NTP. Default value: 'undef'.
#
# @param slewalways
# xntpd setting to disable stepping behavior and always slew the clock to handle adjustments.
# Only relevant for AIX. Default value: 'undef'. Allowed values: 'yes', 'no'
#
# @param statistics
# List of statistics to have NTP generate and keep. Default value: [ ].
#
Expand Down Expand Up @@ -237,6 +241,7 @@
Boolean $service_manage,
String $service_name,
Optional[String] $service_provider,
Optional[Enum['yes','no']] $slewalways,
Optional[Array] $statistics,
Optional[Stdlib::Absolutepath] $statsdir,
Optional[Integer[0, 65535]] $stepout,
Expand Down
38 changes: 38 additions & 0 deletions spec/classes/ntp_spec.rb
Expand Up @@ -438,6 +438,44 @@
}
end
end

describe 'slewalways' do
context 'when absent' do
if f[:kernel] == 'AIX'
it 'on AIX does contain "slewalways no"' do
is_expected.to contain_file('/etc/ntp.conf').with_content(%r{^slewalways no})
end
else
it 'on non-AIX does not contain a slewalways' do
is_expected.to contain_file('/etc/ntp.conf').without_content(%r{^slewalways})
end
end
end

context 'when "no"' do
let(:params) do
{
slewalways: 'no',
}
end

it 'does contain "slewalways no"' do
is_expected.to contain_file('/etc/ntp.conf').with_content(%r{^slewalways no})
end
end

context 'when "yes"' do
let(:params) do
{
slewalways: 'yes',
}
end

it 'does contain "slewalways yes"' do
is_expected.to contain_file('/etc/ntp.conf').with_content(%r{^slewalways yes})
end
end
end
end

describe 'ntp::install' do
Expand Down
5 changes: 5 additions & 0 deletions templates/ntp.conf.epp
Expand Up @@ -139,3 +139,8 @@ tos <% if $ntp::tos_minclock {-%> minclock <%= $ntp::tos_minclock %><% } %> <% i
<% if $ntp::authprov {-%>
authprov <%= $ntp::authprov %>
<% } -%>

<% if $ntp::slewalways {-%>
slewalways <%= $ntp::slewalways -%>
<% } -%>

0 comments on commit 0c3f1e0

Please sign in to comment.