|
1 | 1 | 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, |
7 | 6 | 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, |
43 | 42 | 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, |
56 | 55 | ) {
|
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 |
| - |
183 | 56 | # defaults for tinker and panic are different, when running on virtual machines
|
184 | 57 | if str2bool($facts['is_virtual']) {
|
185 | 58 | $_tinker = pick($tinker, true)
|
|
189 | 62 | $_panic = $panic
|
190 | 63 | }
|
191 | 64 |
|
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 |
| - |
197 | 65 | # Anchor this as per #8040 - this ensures that classes won't float off and
|
198 | 66 | # mess everything up. You can read about this at:
|
199 | 67 | # http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues
|
|
202 | 70 | class { '::ntp::config': } ~>
|
203 | 71 | class { '::ntp::service': } ->
|
204 | 72 | anchor { 'ntp::end': }
|
205 |
| - |
206 | 73 | }
|
0 commit comments