Skip to content

Commit c23fbc8

Browse files
committed
(CONT-360) Syntax Syntax_update
This code is now compliant with the rules regarding: legacy facts top-scope facts top-scope variables variables not enclosed relative classname reference
1 parent c5edfdb commit c23fbc8

File tree

6 files changed

+88
-105
lines changed

6 files changed

+88
-105
lines changed

.puppet-lint.rc

-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
--relative
2-
--no-legacy_facts-check
3-
--no-top_scope_facts-check
4-
--no-topscope_variable-check
5-
--no-relative_classname_reference-check
6-
--no-variables_not_enclosed-check

.sync.yml

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ Rakefile:
1919
t.rspec_opts = "--tag integration"
2020
end
2121
end
22-
extra_disabled_lint_checks:
23-
- legacy_facts
24-
- top_scope_facts
25-
- topscope_variable
26-
- relative_classname_reference
27-
- variables_not_enclosed
2822
spec/spec_helper.rb:
2923
mock_with: ":rspec"
3024
coverage_report: true

Rakefile

-6
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ def changelog_future_release
4242
end
4343

4444
PuppetLint.configuration.send('disable_relative')
45-
PuppetLint.configuration.send('disable_legacy_facts')
46-
PuppetLint.configuration.send('disable_top_scope_facts')
47-
PuppetLint.configuration.send('disable_topscope_variable')
48-
PuppetLint.configuration.send('disable_relative_classname_reference')
49-
PuppetLint.configuration.send('disable_variables_not_enclosed')
50-
5145

5246
if Bundler.rubygems.find_name('github_changelog_generator').any?
5347
GitHubChangelogGenerator::RakeTask.new :changelog do |config|

manifests/config.pp

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#
66
class ntp::config {
77
#The servers-netconfig file overrides NTP config on SLES 12, interfering with our configuration.
8-
if ($facts['operatingsystem'] == 'SLES' and $facts['operatingsystemmajrelease'] == '12') or
9-
($facts['operatingsystem'] == 'OpenSuSE' and $facts['operatingsystemmajrelease'] == '42') {
8+
if ($facts['os']['name'] == 'SLES' and $facts['os']['release']['major'] == '12') or
9+
($facts['os']['name'] == 'OpenSuSE' and $facts['os']['release']['major'] == '42') {
1010
file { '/var/run/ntp/servers-netconfig':
1111
ensure => 'absent',
1212
}
1313
}
1414

15-
case $::osfamily {
15+
case $facts['os']['family'] {
1616
'redhat': {
1717
$daemon_config = '/etc/sysconfig/ntpd'
1818
if $ntp::daemon_extra_opts {
@@ -23,7 +23,7 @@
2323
match => '^OPTIONS\=',
2424
}
2525
}
26-
if $ntp::user and $facts['operatingsystemmajrelease'] != '6' {
26+
if $ntp::user and $facts['os']['release']['major'] != '6' {
2727
file_line { 'Set NTPD daemon user':
2828
ensure => present,
2929
path => '/etc/systemd/system/multi-user.target.wants/ntpd.service',
@@ -42,7 +42,7 @@
4242
match => '^NTPD_OPTS\=',
4343
}
4444
}
45-
if $ntp::user and $facts['operatingsystemmajrelease'] == '18.04' {
45+
if $ntp::user and $facts['os']['release']['major'] == '18.04' {
4646
file_line { 'Set NTPD daemon user':
4747
ensure => present,
4848
path => '/usr/lib/ntp/ntp-systemd-wrapper',
@@ -106,29 +106,29 @@
106106
ensure => file,
107107
owner => 0,
108108
group => 0,
109-
mode => $::ntp::config_file_mode,
109+
mode => $ntp::config_file_mode,
110110
content => $config_content,
111111
}
112112

113113
#If both epp and erb are defined, throw validation error.
114114
#Otherwise use the defined erb/epp template, or use default
115115

116-
if $::ntp::step_tickers_file {
117-
if $::ntp::step_tickers_template and $::ntp::step_tickers_epp {
116+
if $ntp::step_tickers_file {
117+
if $ntp::step_tickers_template and $ntp::step_tickers_epp {
118118
fail('Cannot supply both step_tickers_file and step_tickers_epp templates for step ticker file')
119-
} elsif $::ntp::step_tickers_template {
119+
} elsif $ntp::step_tickers_template {
120120
$step_ticker_content = template($ntp::step_tickers_template)
121-
} elsif $::ntp::step_tickers_epp {
122-
$step_ticker_content = epp($::ntp::step_tickers_epp)
121+
} elsif $ntp::step_tickers_epp {
122+
$step_ticker_content = epp($ntp::step_tickers_epp)
123123
} else {
124124
$step_ticker_content = epp('ntp/step-tickers.epp')
125125
}
126126

127-
file { $::ntp::step_tickers_file:
127+
file { $ntp::step_tickers_file:
128128
ensure => file,
129129
owner => 0,
130130
group => 0,
131-
mode => $::ntp::config_file_mode,
131+
mode => $ntp::config_file_mode,
132132
content => $step_ticker_content,
133133
}
134134
}

manifests/init.pp

+73-73
Original file line numberDiff line numberDiff line change
@@ -238,76 +238,76 @@
238238
# This is currently restricted to Redhat based systems of version 7 and above and Ubuntu 18.04.
239239
#
240240
class ntp (
241-
Boolean $broadcastclient,
242-
Boolean $burst,
243-
Stdlib::Absolutepath $config,
244-
Optional[Stdlib::Absolutepath] $config_dir,
245-
String $config_file_mode,
246-
Optional[String] $config_epp,
247-
Optional[String] $config_template,
248-
Boolean $disable_auth,
249-
Boolean $disable_dhclient,
250-
Boolean $disable_kernel,
251-
Boolean $disable_monitor,
252-
Boolean $enable_mode7,
253-
Optional[Array[String]] $fudge,
254-
Stdlib::Absolutepath $driftfile,
255-
Optional[Stdlib::Absolutepath] $leapfile,
256-
Optional[Stdlib::Absolutepath] $logfile,
257-
Optional[Variant[String, Integer]] $logfile_group,
258-
String $logfile_mode,
259-
Optional[Variant[String, Integer]] $logfile_user,
260-
Optional[String] $logconfig,
261-
Boolean $iburst_enable,
262-
Array[String] $keys,
263-
Boolean $keys_enable,
264-
Stdlib::Absolutepath $keys_file,
265-
Optional[Ntp::Key_id] $keys_controlkey,
266-
Optional[Ntp::Key_id] $keys_requestkey,
267-
Optional[Array[Ntp::Key_id]] $keys_trusted,
268-
Optional[Ntp::Poll_interval] $minpoll,
269-
Optional[Ntp::Poll_interval] $maxpoll,
270-
String $package_ensure,
271-
Boolean $package_manage,
272-
Array[String] $package_name,
273-
Optional[Integer[0]] $panic,
274-
Array[String] $peers,
275-
Optional[Array[String]] $pool,
276-
Array[String] $preferred_servers,
277-
Array[String] $noselect_servers,
278-
Array[String] $restrict,
279-
Array[String] $interfaces,
280-
Array[String] $interfaces_ignore,
281-
Array[String] $servers,
282-
Boolean $service_enable,
283-
Enum['running', 'stopped'] $service_ensure,
284-
Boolean $service_manage,
285-
String $service_name,
286-
Optional[String] $service_provider,
287-
Boolean $service_hasstatus,
288-
Boolean $service_hasrestart,
289-
Optional[Enum['yes','no']] $slewalways,
290-
Optional[Array] $statistics,
291-
Optional[Stdlib::Absolutepath] $statsdir,
292-
Optional[Integer[0, 65535]] $stepout,
293-
Optional[Stdlib::Absolutepath] $step_tickers_file,
294-
Optional[String] $step_tickers_epp,
295-
Optional[String] $step_tickers_template,
296-
Optional[Boolean] $tinker,
297-
Boolean $tos,
298-
Optional[Integer[1]] $tos_maxclock,
299-
Optional[Integer[1]] $tos_minclock,
300-
Optional[Integer[1]] $tos_minsane,
301-
Optional[Integer[1]] $tos_floor,
302-
Optional[Integer[1]] $tos_ceiling,
303-
Optional[Integer[1]] $tos_orphan,
304-
Variant[Boolean, Integer[0,1]] $tos_cohort,
305-
Boolean $udlc,
306-
Optional[Integer[1,15]] $udlc_stratum,
307-
Optional[Stdlib::Absolutepath] $ntpsigndsocket,
308-
Optional[String] $authprov,
309-
Optional[String] $user,
310-
Optional[String] $daemon_extra_opts,
241+
Boolean $broadcastclient,
242+
Boolean $burst,
243+
Stdlib::Absolutepath $config,
244+
Optional[Stdlib::Absolutepath] $config_dir,
245+
String $config_file_mode,
246+
Optional[String] $config_epp,
247+
Optional[String] $config_template,
248+
Boolean $disable_auth,
249+
Boolean $disable_dhclient,
250+
Boolean $disable_kernel,
251+
Boolean $disable_monitor,
252+
Boolean $enable_mode7,
253+
Optional[Array[String]] $fudge,
254+
Stdlib::Absolutepath $driftfile,
255+
Optional[Stdlib::Absolutepath] $leapfile,
256+
Optional[Stdlib::Absolutepath] $logfile,
257+
Optional[Variant[String, Integer]] $logfile_group,
258+
String $logfile_mode,
259+
Optional[Variant[String, Integer]] $logfile_user,
260+
Optional[String] $logconfig,
261+
Boolean $iburst_enable,
262+
Array[String] $keys,
263+
Boolean $keys_enable,
264+
Stdlib::Absolutepath $keys_file,
265+
Optional[Ntp::Key_id] $keys_controlkey,
266+
Optional[Ntp::Key_id] $keys_requestkey,
267+
Optional[Array[Ntp::Key_id]] $keys_trusted,
268+
Optional[Ntp::Poll_interval] $minpoll,
269+
Optional[Ntp::Poll_interval] $maxpoll,
270+
String $package_ensure,
271+
Boolean $package_manage,
272+
Array[String] $package_name,
273+
Optional[Integer[0]] $panic,
274+
Array[String] $peers,
275+
Optional[Array[String]] $pool,
276+
Array[String] $preferred_servers,
277+
Array[String] $noselect_servers,
278+
Array[String] $restrict,
279+
Array[String] $interfaces,
280+
Array[String] $interfaces_ignore,
281+
Array[String] $servers,
282+
Boolean $service_enable,
283+
Enum['running', 'stopped'] $service_ensure,
284+
Boolean $service_manage,
285+
String $service_name,
286+
Optional[String] $service_provider,
287+
Boolean $service_hasstatus,
288+
Boolean $service_hasrestart,
289+
Optional[Enum['yes','no']] $slewalways,
290+
Optional[Array] $statistics,
291+
Optional[Stdlib::Absolutepath] $statsdir,
292+
Optional[Integer[0, 65535]] $stepout,
293+
Optional[Stdlib::Absolutepath] $step_tickers_file,
294+
Optional[String] $step_tickers_epp,
295+
Optional[String] $step_tickers_template,
296+
Optional[Boolean] $tinker,
297+
Boolean $tos,
298+
Optional[Integer[1]] $tos_maxclock,
299+
Optional[Integer[1]] $tos_minclock,
300+
Optional[Integer[1]] $tos_minsane,
301+
Optional[Integer[1]] $tos_floor,
302+
Optional[Integer[1]] $tos_ceiling,
303+
Optional[Integer[1]] $tos_orphan,
304+
Variant[Boolean, Integer[0,1]] $tos_cohort,
305+
Boolean $udlc,
306+
Optional[Integer[1,15]] $udlc_stratum,
307+
Optional[Stdlib::Absolutepath] $ntpsigndsocket,
308+
Optional[String] $authprov,
309+
Optional[String] $user,
310+
Optional[String] $daemon_extra_opts,
311311
) {
312312
# defaults for tinker and panic are different, when running on virtual machines
313313
if $facts['is_virtual'] {
@@ -322,7 +322,7 @@
322322
contain ntp::config
323323
contain ntp::service
324324

325-
Class['::ntp::install']
326-
-> Class['::ntp::config']
327-
~> Class['::ntp::service']
325+
Class['ntp::install']
326+
-> Class['ntp::config']
327+
~> Class['ntp::service']
328328
}

plans/acceptance/provision_integration.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
Optional[String] $provision_type = 'provision_service',
1010
) {
1111
#provision server machine, set role
12-
run_task("provision::$provision_type", 'localhost', action => 'provision', platform => $image, vars => 'role: ntpserver')
13-
run_task("provision::$provision_type", 'localhost', action => 'provision', platform => $image, vars => 'role: ntpclient')
12+
run_task("provision::${provision_type}", 'localhost', action => 'provision', platform => $image, vars => 'role: ntpserver')
13+
run_task("provision::${provision_type}", 'localhost', action => 'provision', platform => $image, vars => 'role: ntpclient')
1414
}

0 commit comments

Comments
 (0)