Skip to content

Commit 9f8be59

Browse files
committed
(FM-5361) Remove all deprecated functionality
This finishes the move to a cleaner puppet4 interface. Since this is a breaking change, it also bumps the major version. Users of the previous version who were running without receiving any deprecation warnings can use this version without any changes.
1 parent 7553fec commit 9f8be59

File tree

8 files changed

+68
-243
lines changed

8 files changed

+68
-243
lines changed

README.markdown

+3-7
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ class { '::ntp':
131131

132132
The following parameters are available in the `::ntp` class:
133133

134-
####`autoupdate`
135-
136-
**Deprecated; replaced by the `package_ensure` parameter**. Tells Puppet whether to keep the ntp module updated to the latest version available. Valid options: true or false. Default value: false
137-
138134
####`broadcastclient`
139135

140136
Enable reception of broadcast server messages to any local interface.
@@ -162,7 +158,7 @@ Specifies a file to act as a EPP template for the config file. Valid options: st
162158

163159
####`disable_auth`
164160

165-
Do not require cryptographic authentication for broadcast client, multicast
161+
Do not require cryptographic authentication for broadcast client, multicast
166162
client and symmetric passive associations.
167163

168164
####`disable_auth`
@@ -239,10 +235,10 @@ Tells Puppet to use non-standard maximal poll interval of upstream servers. Vali
239235
####`ntpsigndsocket`
240236

241237
Tells NTP to sign packets using the socket in the ntpsigndsocket path. NTP must be configured to sign sockets for this to work.
242-
Valid option: a path to the socket directory; for example, for Samba it would be:
238+
Valid option: a path to the socket directory; for example, for Samba it would be:
243239

244240
~~~~
245-
ntpsigndsocket = usr/local/samba/var/lib/ntp_signd/
241+
ntpsigndsocket = usr/local/samba/var/lib/ntp_signd/
246242
~~~~
247243

248244
Default value: undef.

data/common.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
ntp::authprov: ~
3-
ntp::autoupdate: false
43
ntp::broadcastclient: false
54
ntp::config_dir: ~
65
ntp::config_file_mode: '0644'

lib/puppet/functions/ntp_dirname.rb

-10
This file was deleted.

lib/puppet/parser/functions/ntp_dirname.rb

-17
This file was deleted.

manifests/init.pp

+51-184
Original file line numberDiff line numberDiff line change
@@ -1,185 +1,58 @@
11
class ntp (
2-
Any $autoupdate,
3-
Variant[Boolean, Stdlib::Compat::Bool] $broadcastclient,
4-
Variant[Stdlib::Absolutepath, Stdlib::Compat::Absolute_path] $config,
5-
Variant[Optional[Stdlib::Absolutepath], Any, Undef, Stdlib::Compat::Absolute_path] $config_dir,
6-
Variant[String, Any] $config_file_mode,
2+
Boolean $broadcastclient,
3+
Stdlib::Absolutepath $config,
4+
Optional[Stdlib::Absolutepath] $config_dir,
5+
String $config_file_mode,
76
Optional[String] $config_epp,
8-
Variant[String[1], Stdlib::Compat::String] $config_template,
9-
Variant[Boolean, Stdlib::Compat::Bool] $disable_auth,
10-
Variant[Boolean, Stdlib::Compat::Bool] $disable_dhclient,
11-
Variant[Boolean, Stdlib::Compat::Bool] $disable_kernel,
12-
Variant[Boolean, Stdlib::Compat::Bool] $disable_monitor,
13-
Variant[Optional[Array[String]], Stdlib::Compat::Array] $fudge,
14-
Variant[Stdlib::Absolutepath, Stdlib::Compat::Absolute_path] $driftfile,
15-
Variant[Optional[Stdlib::Absolutepath], Boolean, Undef, Stdlib::Compat::Absolute_path] $leapfile,
16-
Variant[Optional[Stdlib::Absolutepath], Boolean, Undef, Stdlib::Compat::Absolute_path] $logfile,
17-
Variant[Boolean, Stdlib::Compat::Bool] $iburst_enable,
18-
Variant[Array[String], Stdlib::Compat::Array] $keys,
19-
Variant[Boolean, Stdlib::Compat::Bool] $keys_enable,
20-
Variant[Stdlib::Absolutepath, Any] $keys_file,
21-
Variant[Optional[Ntp::Key_id], Pattern['^\d+$'], Pattern['']] $keys_controlkey,
22-
Variant[Optional[Ntp::Key_id], Pattern['^\d+$'], Pattern['']] $keys_requestkey,
23-
Variant[Optional[Array[Ntp::Key_id]], Stdlib::Compat::Array] $keys_trusted,
24-
Variant[Optional[Ntp::Poll_interval], Boolean, Undef, Stdlib::Compat::Numeric] $minpoll,
25-
Variant[Optional[Ntp::Poll_interval], Boolean, Undef, Stdlib::Compat::Numeric] $maxpoll,
26-
Variant[String, Stdlib::Compat::String] $package_ensure,
27-
Variant[Boolean, Stdlib::Compat::Bool] $package_manage,
28-
Variant[Array[String], Stdlib::Compat::Array] $package_name,
29-
Variant[Optional[Integer[0]], Undef, Stdlib::Compat::Numeric] $panic,
30-
Variant[Array[String], Stdlib::Compat::Array] $peers,
31-
Variant[Array[String], Stdlib::Compat::Array] $preferred_servers,
32-
Variant[Array[String], Stdlib::Compat::Array] $restrict,
33-
Variant[Array[String], Stdlib::Compat::Array] $interfaces,
34-
Variant[Array[String], Any] $interfaces_ignore,
35-
Variant[Array[String], Stdlib::Compat::Array] $servers,
36-
Variant[Boolean, Stdlib::Compat::Bool] $service_enable,
37-
Variant[String, Stdlib::Compat::String] $service_ensure,
38-
Variant[Boolean, Stdlib::Compat::Bool] $service_manage,
39-
Variant[String, Stdlib::Compat::String] $service_name,
40-
Variant[String, Any] $service_provider,
41-
Variant[Optional[Integer[0, 65535]], Boolean, Undef, Stdlib::Compat::Numeric] $stepout,
42-
Variant[Optional[Stdlib::Absolutepath], Boolean, Undef, Stdlib::Compat::String] $step_tickers_file,
7+
Optional[String] $config_template,
8+
Boolean $disable_auth,
9+
Boolean $disable_dhclient,
10+
Boolean $disable_kernel,
11+
Boolean $disable_monitor,
12+
Optional[Array[String]] $fudge,
13+
Stdlib::Absolutepath $driftfile,
14+
Optional[Stdlib::Absolutepath] $leapfile,
15+
Optional[Stdlib::Absolutepath] $logfile,
16+
Boolean $iburst_enable,
17+
Array[String] $keys,
18+
Boolean $keys_enable,
19+
Stdlib::Absolutepath $keys_file,
20+
Optional[Ntp::Key_id] $keys_controlkey,
21+
Optional[Ntp::Key_id] $keys_requestkey,
22+
Optional[Array[Ntp::Key_id]] $keys_trusted,
23+
Optional[Ntp::Poll_interval] $minpoll,
24+
Optional[Ntp::Poll_interval] $maxpoll,
25+
String $package_ensure,
26+
Boolean $package_manage,
27+
Array[String] $package_name,
28+
Optional[Integer[0]] $panic,
29+
Array[String] $peers,
30+
Array[String] $preferred_servers,
31+
Array[String] $restrict,
32+
Array[String] $interfaces,
33+
Array[String] $interfaces_ignore,
34+
Array[String] $servers,
35+
Boolean $service_enable,
36+
String $service_ensure,
37+
Boolean $service_manage,
38+
String $service_name,
39+
Optional[String] $service_provider,
40+
Optional[Integer[0, 65535]] $stepout,
41+
Optional[Stdlib::Absolutepath] $step_tickers_file,
4342
Optional[String] $step_tickers_epp,
44-
Variant[Optional[String], Any, Undef, Stdlib::Compat::String] $step_tickers_template,
45-
Variant[Optional[Boolean], Optional[Stdlib::Compat::Bool]] $tinker,
46-
Variant[Boolean, Stdlib::Compat::Bool] $tos,
47-
Variant[Optional[Integer[1]], Boolean, Undef, Stdlib::Compat::Numeric] $tos_minclock,
48-
Variant[Optional[Integer[1]], Boolean, Undef, Stdlib::Compat::Numeric] $tos_minsane,
49-
Variant[Optional[Integer[1]], Boolean, Undef, Stdlib::Compat::Numeric] $tos_floor,
50-
Variant[Optional[Integer[1]], Boolean, Undef, Stdlib::Compat::Numeric] $tos_ceiling,
51-
Variant[Variant[Boolean, Integer[0,1]], Boolean, Undef, Pattern['^[0|1]$']] $tos_cohort,
52-
Variant[Boolean, Stdlib::Compat::Bool] $udlc,
53-
Variant[Optional[Integer[1,15]], Any] $udlc_stratum,
54-
Variant[Optional[Stdlib::Absolutepath], Boolean, Undef, Stdlib::Compat::Absolute_path] $ntpsigndsocket,
55-
Variant[Optional[String], Any, Undef, Stdlib::Compat::String] $authprov,
43+
Optional[String] $step_tickers_template,
44+
Optional[Boolean] $tinker,
45+
Boolean $tos,
46+
Optional[Integer[1]] $tos_minclock,
47+
Optional[Integer[1]] $tos_minsane,
48+
Optional[Integer[1]] $tos_floor,
49+
Optional[Integer[1]] $tos_ceiling,
50+
Variant[Boolean, Integer[0,1]] $tos_cohort,
51+
Boolean $udlc,
52+
Optional[Integer[1,15]] $udlc_stratum,
53+
Optional[Stdlib::Absolutepath] $ntpsigndsocket,
54+
Optional[String] $authprov,
5655
) {
57-
58-
validate_legacy(Boolean, 'validate_bool', $broadcastclient)
59-
validate_legacy(Stdlib::Absolutepath, 'validate_absolute_path', $config)
60-
61-
assert_type(String, $config_file_mode) |$expected, $actual| {
62-
deprecation("ntp::config_file_mode should be '${expected}', not '${actual}'")
63-
}
64-
65-
validate_legacy(String[1], 'validate_string', $config_template)
66-
validate_legacy(Boolean, 'validate_bool', $disable_auth)
67-
validate_legacy(Boolean, 'validate_bool', $disable_dhclient)
68-
validate_legacy(Boolean, 'validate_bool', $disable_kernel)
69-
validate_legacy(Boolean, 'validate_bool', $disable_monitor)
70-
validate_legacy(Stdlib::Absolutepath, 'validate_absolute_path', $driftfile)
71-
72-
if $logfile { validate_legacy(Optional[Stdlib::Absolutepath], 'validate_absolute_path', $logfile) }
73-
elsif $logfile == undef { }
74-
else { deprecation('ntp::logfile is false, but should be undef') }
75-
76-
if $ntpsigndsocket { validate_legacy(Optional[Stdlib::Absolutepath], 'validate_absolute_path', $ntpsigndsocket) }
77-
elsif $ntpsigndsocket == undef { }
78-
else { deprecation('ntp::ntpsigndsocket is false, but should be undef') }
79-
80-
if $leapfile { validate_legacy(Optional[Stdlib::Absolutepath], 'validate_absolute_path', $leapfile) }
81-
elsif $leapfile == undef { }
82-
else { deprecation('ntp::leapfile is false, but should be undef') }
83-
84-
validate_legacy(Boolean, 'validate_bool', $iburst_enable)
85-
validate_legacy(Array[String], 'validate_array', $keys)
86-
validate_legacy(Boolean, 'validate_bool', $keys_enable)
87-
validate_legacy(Optional[Ntp::Key_id], 'validate_re', $keys_controlkey, ['^\d+$', ''])
88-
validate_legacy(Optional[Ntp::Key_id], 'validate_re', $keys_requestkey, ['^\d+$', ''])
89-
validate_legacy(Optional[Array[Ntp::Key_id]], 'validate_array', $keys_trusted)
90-
if $minpoll { validate_legacy(Optional[Ntp::Poll_interval], 'validate_numeric', $minpoll, 16, 3) }
91-
elsif $minpoll == undef { }
92-
else { deprecation('ntp::minpoll is false, but should be undef') }
93-
94-
if $maxpoll { validate_legacy(Optional[Ntp::Poll_interval], 'validate_numeric', $maxpoll, 16, 3) }
95-
elsif $maxpoll == undef { }
96-
else { deprecation('ntp::maxpoll is false, but should be undef') }
97-
98-
validate_legacy(String, 'validate_string', $package_ensure)
99-
validate_legacy(Boolean, 'validate_bool', $package_manage)
100-
validate_legacy(Array[String], 'validate_array', $package_name)
101-
102-
validate_legacy(Array[String], 'validate_array', $preferred_servers)
103-
validate_legacy(Array[String], 'validate_array', $restrict)
104-
validate_legacy(Array[String], 'validate_array', $interfaces)
105-
assert_type(Array[String], $interfaces_ignore) |$expected, $actual| {
106-
deprecation("ntp::interfaces_ignore should be '${expected}', not '${actual}'")
107-
}
108-
validate_legacy(Array[String], 'validate_array', $servers)
109-
validate_legacy(Array[String], 'validate_array', $fudge)
110-
validate_legacy(Boolean, 'validate_bool', $service_enable)
111-
validate_legacy(String, 'validate_string', $service_ensure)
112-
validate_legacy(Boolean, 'validate_bool', $service_manage)
113-
validate_legacy(String, 'validate_string', $service_name)
114-
assert_type(String, $service_provider) |$expected, $actual| {
115-
deprecation('puppet_3_type_check', "ntp::service_provider should be '${expected}', not '${actual}'")
116-
}
117-
118-
if $stepout { validate_legacy(Optional[Integer[0, 65535]], 'validate_numeric', $stepout, 65535, 0) }
119-
elsif $stepout == undef { }
120-
else { deprecation('puppet_3_type_check', 'ntp::stepout is false, but should be undef') }
121-
122-
if $step_tickers_file {
123-
validate_legacy(Optional[Stdlib::Absolutepath], 'validate_string', $step_tickers_file)
124-
validate_legacy(Optional[String], 'validate_string', $step_tickers_template)
125-
}
126-
elsif $step_tickers_file == undef { }
127-
else { deprecation('puppet_3_type_check', 'ntp::step_tickers_file is false, but should be undef') }
128-
129-
# In cases where $step_tickers_file evaluated to false, anything could have been
130-
# passed to $step_tickers_template. This deprecation removes that hole.
131-
assert_type(Optional[String], $step_tickers_template) |$expected, $actual| {
132-
deprecation('puppet_3_type_check', "ntp::step_tickers_template should be '${expected}', not '${actual}'")
133-
}
134-
135-
validate_legacy(Boolean, 'validate_bool', $tos)
136-
if $tos_minclock { validate_legacy(Optional[Integer[1]], 'validate_numeric', $tos_minclock) }
137-
elsif $tos_minclock == undef { }
138-
else { deprecation('puppet_3_type_check', 'ntp::tos_minclock is false, but should be undef') }
139-
140-
if $tos_minsane { validate_legacy(Optional[Integer[1]], 'validate_numeric', $tos_minsane) }
141-
elsif $tos_minsane == undef { }
142-
else { deprecation('puppet_3_type_check', 'ntp::tos_minsane is false, but should be undef') }
143-
144-
if $tos_floor { validate_legacy(Optional[Integer[1]], 'validate_numeric', $tos_floor) }
145-
elsif $tos_floor == undef { }
146-
else { deprecation('puppet_3_type_check', 'ntp::tos_floor is false, but should be undef') }
147-
148-
if $tos_ceiling { validate_legacy(Optional[Integer[1]], 'validate_numeric', $tos_ceiling) }
149-
elsif $tos_ceiling == undef { }
150-
else { deprecation('puppet_3_type_check', 'ntp::tos_ceiling is false, but should be undef') }
151-
152-
if $tos_cohort { validate_legacy(Variant[Boolean, Integer[0,1]], 'validate_re', $tos_cohort, '^[0|1]$', "Must be 0 or 1, got: ${tos_cohort}") }
153-
elsif $tos_cohort == undef { }
154-
elsif $tos_cohort == false { }
155-
else {
156-
# No idea what else could come through here, but better safe than sorry, and
157-
# with the next major release, this will go away, anyways.
158-
assert_type(Optional[Variant[Boolean, Integer[0,1]]], $tos_cohort) |$expected, $actual| {
159-
deprecation('puppet_3_type_check', "ntp::tos_cohort should be '${expected}', not '${actual}'")
160-
}
161-
}
162-
163-
validate_legacy(Boolean, 'validate_bool', $udlc)
164-
assert_type(Optional[Integer[1,15]], $udlc_stratum) |$expected, $actual| {
165-
deprecation('puppet_3_type_check', "ntp::udlc_stratum should be '${expected}', not '${actual}'")
166-
}
167-
168-
validate_legacy(Array[String], 'validate_array', $peers)
169-
if $authprov { validate_legacy(Optional[String], 'validate_string', $authprov) }
170-
elsif $authprov == undef { }
171-
else { deprecation('puppet_3_type_check', 'ntp::authprov is false, but should be undef') }
172-
173-
174-
if $config_dir { validate_legacy(Optional[Stdlib::Absolutepath], 'validate_absolute_path', $config_dir) }
175-
elsif $config_dir == undef { }
176-
else { deprecation('puppet_3_type_check', 'ntp::config_dir is false, but should be undef') }
177-
178-
179-
if $autoupdate {
180-
deprecation('ntp::autoupdate', 'ntp: autoupdate parameter has been deprecated and replaced with package_ensure. Set package_ensure to latest for the same behavior as autoupdate => true.')
181-
}
182-
18356
# defaults for tinker and panic are different, when running on virtual machines
18457
if str2bool($facts['is_virtual']) {
18558
$_tinker = pick($tinker, true)
@@ -189,11 +62,6 @@
18962
$_panic = $panic
19063
}
19164

192-
validate_legacy(Boolean, 'validate_bool', $_tinker)
193-
if $_panic { validate_legacy(Optional[Integer[0]], 'validate_numeric', $_panic, 65535, 0) }
194-
elsif $_panic == undef { }
195-
else { deprecation('puppet_3_type_check', 'ntp::panic is false, but should be undef') }
196-
19765
# Anchor this as per #8040 - this ensures that classes won't float off and
19866
# mess everything up. You can read about this at:
19967
# http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues
@@ -202,5 +70,4 @@
20270
class { '::ntp::config': } ~>
20371
class { '::ntp::service': } ->
20472
anchor { 'ntp::end': }
205-
20673
}

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-ntp",
3-
"version": "5.0.0",
3+
"version": "6.0.0",
44
"author": "Puppet Labs",
55
"summary": "Installs, configures, and manages the NTP service.",
66
"license": "Apache-2.0",

spec/acceptance/ntp_parameters_spec.rb

+3-13
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@
5959
end
6060
end
6161

62-
describe 'autoupdate' do
63-
it 'raises a deprecation warning' do
64-
pp = "class { 'ntp': autoupdate => true }"
65-
66-
apply_manifest(pp, :catch_failures => true) do |r|
67-
expect(r.stderr).to match(/autoupdate parameter has been deprecated and replaced with package_ensure/)
68-
end
69-
end
70-
end
71-
7262
describe 'config' do
7363
it 'sets the ntp.conf location' do
7464
pp = "class { 'ntp': config => '/etc/antp.conf' }"
@@ -145,9 +135,9 @@
145135
pp = <<-EOS
146136
class { 'ntp':
147137
keys_enable => true,
148-
keys_controlkey => '15',
149-
keys_requestkey => '1',
150-
keys_trusted => [ '1', '2' ],
138+
keys_controlkey => 15,
139+
keys_requestkey => 1,
140+
keys_trusted => [ 1, 2 ],
151141
keys => [ '1 M AAAABBBB' ],
152142
}
153143
EOS

0 commit comments

Comments
 (0)