Skip to content

Commit 6e72ade

Browse files
author
Ashley Penney
committed
Merge pull request #128 from apenney/disable_monitor
Add support for `disable_monitor` as a new parameter.
2 parents ed56e14 + 5dc164f commit 6e72ade

File tree

5 files changed

+42
-0
lines changed

5 files changed

+42
-0
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/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:" 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

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
tinker panic 0
77
<% end -%>
88

9+
<% if @disable_monitor == true -%>
10+
disable monitor
11+
<% end -%>
12+
913
<% if @restrict != [] -%>
1014
# Permit time synchronization with our time source, but do not'
1115
# permit the source to query or modify the service on this system.'
@@ -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)