Skip to content

Commit 0753ef2

Browse files
committed
Merge remote-tracking branch 'puppetlabs/master' into 3.0.x
2 parents 38088b3 + 3aadddd commit 0753ef2

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

README.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ Sets the file that ntp configuration is written into.
120120

121121
Determines which template Puppet should use for the ntp configuration.
122122

123+
####`disable_monitor`
124+
125+
Disables monitoring of ntp.
126+
123127
####`driftfile`
124128

125129
Sets the location of the drift file for ntp.

manifests/config.pp

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
class ntp::config inherits ntp {
33

44
if $keys_enable {
5-
# Workaround for the lack of dirname() in stdlib 3.2.
6-
$directory = inline_template('<%= File.dirname(keys_file) %>')
5+
$directory = dirname($keys_file)
76
file { $directory:
87
ensure => directory,
98
owner => 0,

manifests/init.pp

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
$autoupdate = $ntp::params::autoupdate,
33
$config = $ntp::params::config,
44
$config_template = $ntp::params::config_template,
5+
$disable_monitor = $ntp::params::disable_monitor,
56
$driftfile = $ntp::params::driftfile,
67
$keys_enable = $ntp::params::keys_enable,
78
$keys_file = $ntp::params::keys_file,
@@ -23,6 +24,7 @@
2324

2425
validate_absolute_path($config)
2526
validate_string($config_template)
27+
validate_bool($disable_monitor)
2628
validate_absolute_path($driftfile)
2729
validate_bool($keys_enable)
2830
validate_re($keys_controlkey, ['^\d+$', ''])

manifests/params.pp

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
$autoupdate = false
44
$config_template = 'ntp/ntp.conf.erb'
5+
$disable_monitor = false
56
$keys_enable = false
67
$keys_controlkey = ''
78
$keys_requestkey = ''
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe "ntp class with disable_monitor:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
4+
context 'should run successfully' do
5+
pp = "class { 'ntp': disable_monitor => true }"
6+
7+
it 'runs twice' do
8+
apply_manifest(pp, :catch_failures => true)
9+
apply_manifest(pp, :catch_changes => true)
10+
end
11+
12+
describe file('/etc/ntp.conf') do
13+
it { should contain('disable monitor') }
14+
end
15+
end
16+
17+
context 'should run successfully' do
18+
pp = "class { 'ntp': disable_monitor => false }"
19+
20+
it 'runs twice' do
21+
apply_manifest(pp, :catch_failures => true)
22+
apply_manifest(pp, :catch_changes => true)
23+
end
24+
25+
describe file('/etc/ntp.conf') do
26+
it { should_not contain('disable monitor') }
27+
end
28+
end
29+
30+
end

templates/ntp.conf.erb

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
tinker panic 0
77
<% end -%>
88

9+
<% if @disable_monitor == true -%>
10+
disable monitor
11+
<% end -%>
12+
913
<% if @restrict != [] -%>
10-
# Permit time synchronization with our time source, but do not'
11-
# permit the source to query or modify the service on this system.'
14+
# Permit time synchronization with our time source, but do not
15+
# permit the source to query or modify the service on this system.
1216
<% @restrict.flatten.each do |restrict| -%>
1317
restrict <%= restrict %>
1418
<% end %>
@@ -40,4 +44,5 @@ requestkey <%= @keys_requestkey %>
4044
<% if @keys_controlkey != '' -%>
4145
controlkey <%= @keys_controlkey %>
4246
<% end -%>
47+
4348
<% end -%>

0 commit comments

Comments
 (0)