Skip to content

Commit f60f5bc

Browse files
committed
(FM-5361) Remove all the legacy/backwards-compat/deprecation logic
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 3ab61b2 commit f60f5bc

File tree

3 files changed

+54
-183
lines changed

3 files changed

+54
-183
lines changed

.fixtures.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ fixtures:
33
stdlib:
44
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
55
ref: 'experiments/validate-compat-type-aliases'
6+
tea:
7+
repo: 'git://github.com/voxpupuli/puppet-tea.git'
68
symlinks:
79
ntp: "#{source_dir}"

manifests/init.pp

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

metadata.json

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

0 commit comments

Comments
 (0)