Skip to content

Commit 8b54621

Browse files
committed
(maint) puppet-lint topscope_variable check
1 parent c35a6d2 commit 8b54621

File tree

16 files changed

+93
-99
lines changed

16 files changed

+93
-99
lines changed

manifests/install.pp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@
6262
$_package_version = $package_version
6363
$_install_options = concat(['--ignoreos'],$install_options)
6464
$_provider = 'rpm'
65-
$_source = "${::puppet_agent::params::local_packages_dir}/${::puppet_agent::prepare::package::package_file_name}"
65+
$_source = "${puppet_agent::params::local_packages_dir}/${puppet_agent::prepare::package::package_file_name}"
6666
} elsif $facts['os']['family'] == 'Debian' {
6767
$_install_options = $install_options
68-
if $::puppet_agent::absolute_source {
68+
if $puppet_agent::absolute_source {
6969
# absolute_source means we use dpkg on debian based platforms
7070
$_package_version = 'present'
7171
$_provider = 'dpkg'
7272
# The source package should have been downloaded by puppet_agent::prepare::package to the local_packages_dir
73-
$_source = "${::puppet_agent::params::local_packages_dir}/${::puppet_agent::prepare::package::package_file_name}"
73+
$_source = "${puppet_agent::params::local_packages_dir}/${puppet_agent::prepare::package::package_file_name}"
7474
} else {
7575
# any other type of source means we use apt with no 'source' defined in the package resource below
7676
if $package_version =~ /^latest$|^present$/ {
@@ -83,12 +83,12 @@
8383
}
8484
} else { # RPM platforms: EL
8585
$_install_options = $install_options
86-
if $::puppet_agent::absolute_source {
86+
if $puppet_agent::absolute_source {
8787
# absolute_source means we use rpm on EL based platforms
8888
$_package_version = $package_version
8989
$_provider = 'rpm'
9090
# The source package should have been downloaded by puppet_agent::prepare::package to the local_packages_dir
91-
$_source = "${::puppet_agent::params::local_packages_dir}/${::puppet_agent::prepare::package::package_file_name}"
91+
$_source = "${puppet_agent::params::local_packages_dir}/${puppet_agent::prepare::package::package_file_name}"
9292
} else {
9393
# any other type of source means we use a package manager (yum) with no 'source' parameter in the
9494
# package resource below
@@ -98,7 +98,7 @@
9898
}
9999
}
100100
$_aio_package_version = $package_version.match(/^\d+\.\d+\.\d+(\.\d+)?|^latest$|^present$/)[0]
101-
package { $::puppet_agent::package_name:
101+
package { $puppet_agent::package_name:
102102
ensure => $_package_version,
103103
install_options => $_install_options,
104104
provider => $_provider,

manifests/install/solaris.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
) {
1818
assert_private()
1919
if $facts['os']['release']['major'] == '10' {
20-
$_unzipped_package_name = regsubst($::puppet_agent::prepare::package::package_file_name, '\.gz$', '')
20+
$_unzipped_package_name = regsubst($puppet_agent::prepare::package::package_file_name, '\.gz$', '')
2121
$install_script = 'solaris_install.sh.erb'
2222

2323
# The following are expected to be available in the solaris_install.sh.erb template:
2424
$adminfile = '/opt/puppetlabs/packages/solaris-noask'
2525
$sourcefile = "/opt/puppetlabs/packages/${_unzipped_package_name}"
2626

27-
$service_names = $::puppet_agent::service_names
27+
$service_names = $puppet_agent::service_names
2828

2929
# Puppet prior to 5.0 would not use a separate process contract when forking from the Puppet
3030
# service. That resulted in service-initiated upgrades failing because trying to remove or
@@ -49,7 +49,7 @@
4949
}
5050
} else {
5151
$_aio_package_version = $package_version.match(/^\d+\.\d+\.\d+(\.\d+)?/)[0]
52-
package { $::puppet_agent::package_name:
52+
package { $puppet_agent::package_name:
5353
ensure => $package_version,
5454
install_options => $install_options,
5555
notify => Puppet_agent_end_run[$_aio_package_version],

manifests/install/suse.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818
) {
1919
assert_private()
2020

21-
if ($::puppet_agent::absolute_source) or ($facts['os']['release']['major'] == '11' and $::puppet_agent::is_pe) {
21+
if ($puppet_agent::absolute_source) or ($facts['os']['release']['major'] == '11' and $puppet_agent::is_pe) {
2222
$_provider = 'rpm'
23-
$_source = "${::puppet_agent::params::local_packages_dir}/${::puppet_agent::prepare::package::package_file_name}"
23+
$_source = "${puppet_agent::params::local_packages_dir}/${puppet_agent::prepare::package::package_file_name}"
2424

2525
exec { 'GPG check the RPM file':
2626
path => '/bin:/usr/bin:/sbin:/usr/sbin',
2727
command => "rpm -K ${_source}",
2828
require => File[$_source],
2929
logoutput => 'on_failure',
30-
notify => Package[$::puppet_agent::package_name],
30+
notify => Package[$puppet_agent::package_name],
3131
}
3232
} else {
3333
$_provider = 'zypper'
3434
$_source = undef
3535
}
3636

3737
$_aio_package_version = $package_version.match(/^\d+\.\d+\.\d+(\.\d+)?|^latest$|^present$/)[0]
38-
package { $::puppet_agent::package_name:
38+
package { $puppet_agent::package_name:
3939
ensure => $package_version,
4040
install_options => $install_options,
4141
provider => $_provider,

manifests/install/windows.pp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818
) {
1919
assert_private()
2020

21-
$service_names = $::puppet_agent::service_names
21+
$service_names = $puppet_agent::service_names
2222

23-
$_msi_location = $::puppet_agent::prepare::package::local_package_file_path
23+
$_msi_location = $puppet_agent::prepare::package::local_package_file_path
2424

2525
$_install_options = $install_options ? {
2626
[] => windows_msi_installargs(['REINSTALLMODE="amus"']),
2727
default => windows_msi_installargs($install_options)
2828
}
2929

30-
if (member($::puppet_agent::service_names, 'puppet')) {
30+
if (member($puppet_agent::service_names, 'puppet')) {
3131
$_agent_startup_mode = 'Automatic'
3232
} else {
3333
$_agent_startup_mode = undef
3434
}
3535

36-
if $::puppet_agent::msi_move_locked_files {
37-
if ($::puppet_agent::_expected_package_version.match(/^5.5/) and versioncmp($::puppet_agent::_expected_package_version, '5.5.17') < 0) or
38-
($::puppet_agent::_expected_package_version.match(/^6/) and versioncmp($::puppet_agent::_expected_package_version, '6.8.0') < 0) {
36+
if $puppet_agent::msi_move_locked_files {
37+
if ($puppet_agent::_expected_package_version.match(/^5.5/) and versioncmp($puppet_agent::_expected_package_version, '5.5.17') < 0) or
38+
($puppet_agent::_expected_package_version.match(/^6/) and versioncmp($puppet_agent::_expected_package_version, '6.8.0') < 0) {
3939
$_move_dll_workaround = '-UseLockedFilesWorkaround'
4040
} else {
4141
notify { 'Ignoring msi_move_locked_files setting as it is no longer needed with newer puppet-agent versions (puppet 5 >= 5.5.17 or puppet 6 >= 6.8.0)': }
@@ -45,13 +45,13 @@
4545
$_move_dll_workaround = undef
4646
}
4747

48-
if $::puppet_agent::wait_for_pxp_agent_exit {
48+
if $puppet_agent::wait_for_pxp_agent_exit {
4949
$_pxp_agent_wait = "-WaitForPXPAgentExit ${puppet_agent::wait_for_pxp_agent_exit}"
5050
} else {
5151
$_pxp_agent_wait = undef
5252
}
5353

54-
if $::puppet_agent::wait_for_puppet_run {
54+
if $puppet_agent::wait_for_puppet_run {
5555
$_puppet_run_wait = "-WaitForPuppetRun ${puppet_agent::wait_for_puppet_run}"
5656
} else {
5757
$_puppet_run_wait = undef

manifests/osfamily/aix.pp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
fail("${facts['os']['name']} not supported")
77
}
88

9-
if $::puppet_agent::is_pe != true {
9+
if $puppet_agent::is_pe != true {
1010
fail('AIX upgrades are only supported on Puppet Enterprise')
1111
}
1212

@@ -35,27 +35,27 @@
3535
# on puppet collection, package version and AIX version.
3636
$_aix_ver_number = regsubst($facts['platform_tag'],'aix-(\d+\.\d+)-power','\1')
3737
if $_aix_ver_number {
38-
if $::puppet_agent::collection =~ /^puppet8/ {
38+
if $puppet_agent::collection =~ /^puppet8/ {
3939
$aix_ver_number = '7.2'
40-
} elsif $::puppet_agent::collection =~ /^puppet7/ {
40+
} elsif $puppet_agent::collection =~ /^puppet7/ {
4141
$aix_ver_number = '7.1'
4242
} else {
4343
# 6.19.1 is the last puppet6 release that ships AIX 6.1 packages
44-
$aix_ver_number = versioncmp($::puppet_agent::prepare::package_version, '6.19.1') ? {
44+
$aix_ver_number = versioncmp($puppet_agent::prepare::package_version, '6.19.1') ? {
4545
1 => '7.1',
4646
default => '6.1'
4747
}
4848
}
4949
}
5050

51-
if $::puppet_agent::absolute_source {
52-
$source = $::puppet_agent::absolute_source
53-
} elsif $::puppet_agent::alternate_pe_source {
54-
$source = "${::puppet_agent::alternate_pe_source}/packages/${pe_server_version}/aix-${aix_ver_number}-power/${::puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.aix${aix_ver_number}.ppc.rpm"
55-
} elsif $::puppet_agent::source {
56-
$source = "${::puppet_agent::source}/packages/${pe_server_version}/aix-${aix_ver_number}-power/${::puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.aix${aix_ver_number}.ppc.rpm"
51+
if $puppet_agent::absolute_source {
52+
$source = $puppet_agent::absolute_source
53+
} elsif $puppet_agent::alternate_pe_source {
54+
$source = "${puppet_agent::alternate_pe_source}/packages/${pe_server_version}/aix-${aix_ver_number}-power/${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.aix${aix_ver_number}.ppc.rpm"
55+
} elsif $puppet_agent::source {
56+
$source = "${puppet_agent::source}/packages/${pe_server_version}/aix-${aix_ver_number}-power/${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.aix${aix_ver_number}.ppc.rpm"
5757
} else {
58-
$source = "${::puppet_agent::aix_source}/${pe_server_version}/aix-${aix_ver_number}-power/${::puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.aix${aix_ver_number}.ppc.rpm"
58+
$source = "${puppet_agent::aix_source}/${pe_server_version}/aix-${aix_ver_number}-power/${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.aix${aix_ver_number}.ppc.rpm"
5959
}
6060

6161
class { 'puppet_agent::prepare::package':

manifests/osfamily/darwin.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
$productversion_major = $productversion_array[0]
1010
}
1111

12-
if $::puppet_agent::absolute_source {
13-
$source = $::puppet_agent::absolute_source
14-
} elsif ($::puppet_agent::is_pe and (!$::puppet_agent::use_alternate_sources)) {
12+
if $puppet_agent::absolute_source {
13+
$source = $puppet_agent::absolute_source
14+
} elsif ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
1515
$pe_server_version = pe_build_version()
1616
if $puppet_agent::alternate_pe_source {
1717
$source = "${puppet_agent::alternate_pe_source}/packages/${pe_server_version}/${facts['platform_tag']}/${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
@@ -21,7 +21,7 @@
2121
$source = "puppet:///modules/pe_packages/${pe_server_version}/${facts['platform_tag']}/${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
2222
}
2323
} else {
24-
$source = "${::puppet_agent::mac_source}/mac/${::puppet_agent::collection}/${productversion_major}/${::puppet_agent::arch}/${puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
24+
$source = "${puppet_agent::mac_source}/mac/${puppet_agent::collection}/${productversion_major}/${puppet_agent::arch}/${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.osx${$productversion_major}.dmg"
2525
}
2626

2727
class { 'puppet_agent::prepare::package':

manifests/osfamily/debian.pp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
class puppet_agent::osfamily::debian {
33
assert_private()
44

5-
if $::puppet_agent::absolute_source {
5+
if $puppet_agent::absolute_source {
66
# Absolute sources are expected to be actual packages (not repos)
77
# so when absolute_source is set just download the package to the
88
# system and finish with this class.
@@ -13,8 +13,8 @@
1313
contain puppet_agent::prepare::package
1414
} else {
1515
if getvar('::puppet_agent::manage_repo') == true {
16-
include ::apt
17-
if ($::puppet_agent::is_pe and (!$::puppet_agent::use_alternate_sources)) {
16+
include apt
17+
if ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
1818
$pe_server_version = pe_build_version()
1919
if $puppet_agent::source {
2020
$source = "${puppet_agent::source}/packages/${pe_server_version}/${facts['platform_tag']}"
@@ -29,7 +29,7 @@
2929
# to be configured to pass in the agents certificates. By the time this code is called,
3030
# the module has already moved the certs to $ssl_dir/{certs,private_keys}, which
3131
# happen to be the default in PE already.
32-
$_ssl_dir = $::puppet_agent::params::ssldir
32+
$_ssl_dir = $puppet_agent::params::ssldir
3333
$_sslcacert_path = "${_ssl_dir}/certs/ca.pem"
3434
$_sslclientcert_path = "${_ssl_dir}/certs/${facts['clientcert']}.pem"
3535
$_sslclientkey_path = "${_ssl_dir}/private_keys/${facts['clientcert']}.pem"
@@ -46,7 +46,7 @@
4646

4747
$_apt_settings = concat(
4848
$_ca_cert_verification,
49-
$_proxy_host)
49+
$_proxy_host)
5050

5151
apt::setting { 'conf-pc_repo':
5252
content => $_apt_settings.join(''),
@@ -69,7 +69,7 @@
6969
content => '',
7070
}
7171
} else {
72-
$source = $::puppet_agent::apt_source
72+
$source = $puppet_agent::apt_source
7373
}
7474
$legacy_keyname = 'GPG-KEY-puppet'
7575
$legacy_gpg_path = "/etc/pki/deb-gpg/${legacy_keyname}"
@@ -105,7 +105,7 @@
105105

106106
apt::source { 'pc_repo':
107107
location => $source,
108-
repos => $::puppet_agent::collection,
108+
repos => $puppet_agent::collection,
109109
key => {
110110
'id' => 'D6811ED3ADEEB8441AF5AA8F4528B6CD9E61EF26',
111111
'source' => $gpg_path,
@@ -116,7 +116,7 @@
116116
# apt_update doesn't inherit the future class dependency, so it
117117
# can wait until the end of the run to exec. Force it to happen now.
118118
exec { 'pc_repo_force':
119-
command => "/bin/echo 'forcing apt update for pc_repo ${::puppet_agent::collection}'",
119+
command => "/bin/echo 'forcing apt update for pc_repo ${puppet_agent::collection}'",
120120
refreshonly => true,
121121
logoutput => true,
122122
subscribe => Exec['apt_update'],

manifests/osfamily/redhat.pp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
class puppet_agent::osfamily::redhat {
33
assert_private()
44

5-
if $::puppet_agent::absolute_source {
5+
if $puppet_agent::absolute_source {
66
# Absolute sources are expected to be actual packages (not repos)
77
# so when absolute_source is set just download the package to the
88
# system and finish with this class.
@@ -37,30 +37,30 @@
3737
true => "el-${amz_el_version}-${facts['os']['architecture']}",
3838
default => $facts['platform_tag'],
3939
}
40-
if $::puppet_agent::source {
41-
$source = "${::puppet_agent::source}/packages/${pe_server_version}/${pe_repo_dir}"
42-
} elsif $::puppet_agent::alternate_pe_source {
43-
$source = "${::puppet_agent::alternate_pe_source}/packages/${pe_server_version}/${pe_repo_dir}"
40+
if $puppet_agent::source {
41+
$source = "${puppet_agent::source}/packages/${pe_server_version}/${pe_repo_dir}"
42+
} elsif $puppet_agent::alternate_pe_source {
43+
$source = "${puppet_agent::alternate_pe_source}/packages/${pe_server_version}/${pe_repo_dir}"
4444
} else {
4545
$source = "https://${facts['puppet_master_server']}:8140/packages/${pe_server_version}/${pe_repo_dir}"
4646
}
4747
} else {
48-
if $::puppet_agent::collection == 'PC1' {
49-
$source = "${::puppet_agent::yum_source}/${platform_and_version}/${::puppet_agent::collection}/${::puppet_agent::arch}"
48+
if $puppet_agent::collection == 'PC1' {
49+
$source = "${puppet_agent::yum_source}/${platform_and_version}/${puppet_agent::collection}/${puppet_agent::arch}"
5050
} else {
51-
$source = "${::puppet_agent::yum_source}/${::puppet_agent::collection}/${platform_and_version}/${::puppet_agent::arch}"
51+
$source = "${puppet_agent::yum_source}/${puppet_agent::collection}/${platform_and_version}/${puppet_agent::arch}"
5252
}
5353
}
5454

55-
if ($::puppet_agent::is_pe and (!$::puppet_agent::use_alternate_sources)) {
55+
if ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
5656
# In Puppet Enterprise, agent packages are served by the same server
5757
# as the master, which can be using either a self signed CA, or an external CA.
5858
# In order for yum to authenticate to the yumrepo on the PE Master, it will need
5959
# to be configured to pass in the agents certificates. By the time this code is called,
6060
# the module has already moved the certs to $ssl_dir/{certs,private_keys}, which
6161
# happen to be the default in PE already.
6262

63-
$_ssl_dir = $::puppet_agent::params::ssldir
63+
$_ssl_dir = $puppet_agent::params::ssldir
6464
$_sslcacert_path = "${_ssl_dir}/certs/ca.pem"
6565
$_sslclientcert_path = "${_ssl_dir}/certs/${facts['clientcert']}.pem"
6666
$_sslclientkey_path = "${_ssl_dir}/private_keys/${facts['clientcert']}.pem"
@@ -146,22 +146,22 @@
146146
logoutput => 'on_failure',
147147
}
148148

149-
if $::puppet_agent::manage_repo == true {
150-
$_proxy = $::puppet_agent::disable_proxy ? {
149+
if $puppet_agent::manage_repo == true {
150+
$_proxy = $puppet_agent::disable_proxy ? {
151151
true => '_none_',
152-
default => $::puppet_agent::proxy,
152+
default => $puppet_agent::proxy,
153153
}
154154
yumrepo { 'pc_repo':
155155
baseurl => $source,
156-
descr => "Puppet Labs ${::puppet_agent::collection} Repository",
156+
descr => "Puppet Labs ${puppet_agent::collection} Repository",
157157
enabled => true,
158158
gpgcheck => '1',
159159
gpgkey => $gpg_keys,
160160
proxy => $_proxy,
161161
sslcacert => $_sslcacert_path,
162162
sslclientcert => $_sslclientcert_path,
163163
sslclientkey => $_sslclientkey_path,
164-
skip_if_unavailable => $::puppet_agent::skip_if_unavailable,
164+
skip_if_unavailable => $puppet_agent::skip_if_unavailable,
165165
}
166166
}
167167
}

manifests/osfamily/solaris.pp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
fail("${facts['os']['name']} not supported")
77
}
88

9-
if $::puppet_agent::is_pe != true {
9+
if $puppet_agent::is_pe != true {
1010
fail('Solaris upgrades are only supported on Puppet Enterprise')
1111
}
1212

@@ -21,15 +21,15 @@
2121
$source_dir = "${puppet_agent::solaris_source}/${pe_server_version}/${facts['platform_tag']}"
2222
}
2323

24-
$pkg_arch = $::puppet_agent::arch ? {
24+
$pkg_arch = $puppet_agent::arch ? {
2525
/^sun4[uv]$/ => 'sparc',
2626
default => 'i386',
2727
}
2828

2929
case $facts['os']['release']['major'] {
3030
'10': {
31-
$package_file_name = "${::puppet_agent::package_name}-${::puppet_agent::prepare::package_version}-1.${pkg_arch}.pkg.gz"
32-
if $::puppet_agent::absolute_source {
31+
$package_file_name = "${puppet_agent::package_name}-${puppet_agent::prepare::package_version}-1.${pkg_arch}.pkg.gz"
32+
if $puppet_agent::absolute_source {
3333
$source = $source_dir
3434
} else {
3535
$source = "${source_dir}/${package_file_name}"
@@ -57,9 +57,9 @@
5757
}
5858
}
5959
'11': {
60-
if $::puppet_agent::manage_repo {
61-
$package_file_name = "${::puppet_agent::package_name}@${::puppet_agent::prepare::package_version},5.11-1.${pkg_arch}.p5p"
62-
if $::puppet_agent::absolute_source {
60+
if $puppet_agent::manage_repo {
61+
$package_file_name = "${puppet_agent::package_name}@${puppet_agent::prepare::package_version},5.11-1.${pkg_arch}.p5p"
62+
if $puppet_agent::absolute_source {
6363
$source = $source_dir
6464
} else {
6565
$source = "${source_dir}/${package_file_name}"

0 commit comments

Comments
 (0)