Convert all class usage to relative names

Change-Id: I81554d6ab7349a068066a68801124189663490dd
This commit is contained in:
Tobias Urdin 2019-12-08 23:18:50 +01:00 committed by Michele Baldessari
parent a53120f887
commit b501c08640
22 changed files with 57 additions and 60 deletions

View File

@ -29,7 +29,7 @@ group :test do
end
gem 'rspec', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-absolute_classname-check', '~> 0.2.4', :require => false
gem 'puppet-lint-absolute_classname-check', '~> 2.0.0', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
gem 'puppet-lint-version_comparison-check', :require => false

View File

@ -9,7 +9,6 @@ require 'metadata-json-lint/rake_task'
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_documentation')

View File

@ -31,5 +31,5 @@ class hostname (
}
include ::hosts
include ::hostname
include hosts
include hostname

View File

@ -12,9 +12,9 @@ class properties {
}
include ::properties
include properties
class { '::pacemaker::new' :
class { 'pacemaker::new' :
cluster_nodes => ['node'],
cluster_password => 'hacluster',

View File

@ -7,7 +7,7 @@ service { 'service-test1' :
}
# apply a wrapper
::pacemaker::new::wrapper { 'service-test1' :
pacemaker::new::wrapper { 'service-test1' :
primitive_class => 'ocf',
primitive_provider => 'pacemaker',
primitive_type => 'Dummy',

View File

@ -7,7 +7,7 @@ service { 'service-test1' :
}
# apply a wrapper
::pacemaker::new::wrapper { 'service-test1' :
pacemaker::new::wrapper { 'service-test1' :
primitive_class => 'ocf',
primitive_provider => 'pacemaker',
primitive_type => 'Dummy',

View File

@ -13,7 +13,5 @@ define pacemaker::contain ($class_name='') {
$k = pick($class_name, $name)
validate_re($k, '^[^:][^:]', "The class name must be relative not ${k}")
include "::${k}"
# lint:ignore:relative_classname_inclusion
contain $k
# lint:endignore
}

View File

@ -144,7 +144,7 @@ class pacemaker::corosync(
$tls_priorities = undef,
$enable_scaleup = true,
) inherits pacemaker {
include ::pacemaker::params
include pacemaker::params
if ! $cluster_members_rrp {
if $::pacemaker::pcs_010 {
$cluster_members_rrp_real = pcmk_cluster_setup($cluster_members, $cluster_members_addr, '0.10')
@ -190,7 +190,7 @@ class pacemaker::corosync(
path => $::pacemaker::pcsd_sysconfig,
line => "PCSD_DEBUG=${pcsd_debug_str}",
match => '^PCSD_DEBUG=',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Service['pcsd'],
}
@ -200,7 +200,7 @@ class pacemaker::corosync(
path => $::pacemaker::pcsd_sysconfig,
line => "PCSD_BIND_ADDR='${pcsd_bind_addr}'",
match => '^PCSD_BIND_ADDR=',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Service['pcsd'],
}
@ -210,7 +210,7 @@ class pacemaker::corosync(
ensure => absent,
path => $::pacemaker::pcsd_sysconfig,
match => '^PCSD_BIND_ADDR=*',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Service['pcsd'],
match_for_absence => true,
@ -222,7 +222,7 @@ class pacemaker::corosync(
path => $::pacemaker::pcmk_sysconfig,
line => "PCMK_tls_priorities=${tls_priorities}",
match => '^PCMK_tls_priorities=',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
}
}
@ -230,7 +230,7 @@ class pacemaker::corosync(
user { 'hacluster':
password => pw_hash($::pacemaker::hacluster_pwd, 'SHA-512', fqdn_rand_string(10)),
groups => 'haclient',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Exec['reauthenticate-across-all-nodes'],
}
@ -341,7 +341,7 @@ class pacemaker::corosync(
tries => $cluster_start_tries,
try_sleep => $cluster_start_try_sleep,
unless => '/usr/bin/test -f /etc/corosync/corosync.conf',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
}
->
exec {"Start Cluster ${cluster_name}":

View File

@ -48,8 +48,8 @@
#
class pacemaker(
$hacluster_pwd = $pacemaker::params::hacluster_pwd
) inherits ::pacemaker::params {
include ::pacemaker::params
include ::pacemaker::install
include ::pacemaker::service
) inherits pacemaker::params {
include pacemaker::params
include pacemaker::install
include pacemaker::service
}

View File

@ -36,7 +36,7 @@
class pacemaker::install (
$ensure = present,
) {
include ::pacemaker::params
include pacemaker::params
ensure_resource('package', $::pacemaker::params::package_list, {
ensure => present
})

View File

@ -45,9 +45,9 @@ class pacemaker::new (
$pacemaker_enable = $::pacemaker::new::params::pacemaker_enable,
$pacemaker_service = $::pacemaker::new::params::pacemaker_service,
$pacemaker_provider = $::pacemaker::new::params::pacemaker_provider,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
class { '::pacemaker::new::firewall' :
class { 'pacemaker::new::firewall' :
firewall_ipv6_manage => $firewall_ipv6_manage,
firewall_corosync_manage => $firewall_corosync_manage,
firewall_corosync_ensure => $firewall_corosync_ensure,
@ -60,14 +60,14 @@ class pacemaker::new (
firewall_pcsd_action => $firewall_pcsd_action,
}
class { '::pacemaker::new::install' :
class { 'pacemaker::new::install' :
package_manage => $package_manage,
package_list => $package_list,
package_ensure => $package_ensure,
package_provider => $package_provider,
}
class { '::pacemaker::new::setup' :
class { 'pacemaker::new::setup' :
pcsd_mode => $pcsd_mode,
# pcsd only
cluster_nodes => $cluster_nodes,
@ -88,7 +88,7 @@ class pacemaker::new (
log_file_path => $log_file_path,
}
class { '::pacemaker::new::service' :
class { 'pacemaker::new::service' :
pcsd_manage => $pcsd_manage,
pcsd_enable => $pcsd_enable,
pcsd_service => $pcsd_service,
@ -108,13 +108,13 @@ class pacemaker::new (
pacemaker::contain { 'pacemaker::new::setup': }
pacemaker::contain { 'pacemaker::new::service': }
Class['::pacemaker::new::firewall'] ->
Class['::pacemaker::new::install']
Class['pacemaker::new::firewall'] ->
Class['pacemaker::new::install']
Class['::pacemaker::new::install'] ->
Class['::pacemaker::new::service']
Class['pacemaker::new::install'] ->
Class['pacemaker::new::service']
Class['::pacemaker::new::install'] ->
Class['::pacemaker::new::setup']
Class['pacemaker::new::install'] ->
Class['pacemaker::new::setup']
}

View File

@ -55,7 +55,7 @@ class pacemaker::new::firewall (
$firewall_pcsd_ensure = $::pacemaker::new::params::firewall_pcsd_ensure,
$firewall_pcsd_dport = $::pacemaker::new::params::firewall_pcsd_dport,
$firewall_pcsd_action = $::pacemaker::new::params::firewall_pcsd_action,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_bool($firewall_ipv6_manage)
validate_bool($firewall_corosync_manage)

View File

@ -22,7 +22,7 @@ class pacemaker::new::install (
$package_list = $::pacemaker::new::params::package_list,
$package_ensure = $::pacemaker::new::params::package_ensure,
$package_provider = $::pacemaker::new::params::package_provider,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_bool($package_manage)
validate_array($package_list)
validate_string($package_ensure)

View File

@ -17,7 +17,7 @@ class pacemaker::new::service (
$pacemaker_enable = $::pacemaker::new::params::pacemaker_enable,
$pacemaker_service = $::pacemaker::new::params::pacemaker_service,
$pacemaker_provider = $::pacemaker::new::params::pacemaker_provider,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_bool($pcsd_manage)
validate_bool($pcsd_enable)
validate_string($pcsd_service)

View File

@ -22,15 +22,15 @@ class pacemaker::new::setup (
$cluster_log_subsys = $::pacemaker::new::params::cluster_log_subsys,
$plugin_version = $::pacemaker::new::params::plugin_version,
$log_file_path = $::pacemaker::new::params::log_file_path,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
if $::os['family'] == 'Debian' {
class { '::pacemaker::new::setup::debian' :
class { 'pacemaker::new::setup::debian' :
plugin_version => $plugin_version,
}
pacemaker::contain { 'pacemaker::new::setup::debian': }
}
class { '::pacemaker::new::setup::auth_key' :
class { 'pacemaker::new::setup::auth_key' :
cluster_auth_enabled => $cluster_auth_enabled,
cluster_auth_key => $cluster_auth_key,
cluster_user => $cluster_user,
@ -39,7 +39,7 @@ class pacemaker::new::setup (
pacemaker::contain { 'pacemaker::new::setup::auth_key': }
if $pcsd_mode {
class { '::pacemaker::new::setup::pcsd' :
class { 'pacemaker::new::setup::pcsd' :
cluster_nodes => $cluster_nodes,
cluster_rrp_nodes => $cluster_rrp_nodes,
cluster_name => $cluster_name,
@ -52,7 +52,7 @@ class pacemaker::new::setup (
}
pacemaker::contain { 'pacemaker::new::setup::pcsd': }
} else {
class { '::pacemaker::new::setup::config' :
class { 'pacemaker::new::setup::config' :
cluster_nodes => $cluster_nodes,
cluster_rrp_nodes => $cluster_rrp_nodes,
cluster_name => $cluster_name,

View File

@ -26,7 +26,7 @@ class pacemaker::new::setup::auth_key (
$cluster_auth_key = $::pacemaker::new::params::cluster_auth_key,
$cluster_user = $::pacemaker::new::params::cluster_user,
$cluster_group = $::pacemaker::new::params::cluster_group,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_bool($cluster_auth_enabled)
validate_string($cluster_user)
validate_string($cluster_group)
@ -67,4 +67,4 @@ class pacemaker::new::setup::auth_key (
File['corosync-auth-key'] ~>
Service <| tag == 'cluster-service' |>
}
}

View File

@ -121,7 +121,7 @@ class pacemaker::new::setup::config (
$cluster_interfaces = $::pacemaker::new::params::cluster_interfaces,
$cluster_log_subsys = $::pacemaker::new::params::cluster_log_subsys,
$log_file_path = $::pacemaker::new::params::log_file_path,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_absolute_path($log_file_path)
validate_absolute_path($cluster_config_path)
validate_hash($cluster_options)

View File

@ -5,7 +5,7 @@
#
class pacemaker::new::setup::debian (
$plugin_version = $pacemaker::new::params::plugin_version,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_integer($plugin_version)
File {
@ -53,4 +53,4 @@ class pacemaker::new::setup::debian (
File['cman-debian-default'] ~>
Service <| tag == 'cluster-service' |>
}
}

View File

@ -145,7 +145,7 @@ class pacemaker::new::setup::pcsd (
$cluster_group = $::pacemaker::new::params::cluster_group,
$cluster_password = $::pacemaker::new::params::cluster_password,
$pcs_bin_path = $::pacemaker::new::params::pcs_bin_path,
) inherits ::pacemaker::new::params {
) inherits pacemaker::new::params {
validate_string($cluster_name)
validate_bool($cluster_setup)
validate_string($cluster_user)

View File

@ -59,13 +59,13 @@ class pacemaker::remote (
$force_authkey = undef,
$tls_priorities = undef,
) {
include ::pacemaker::params
include pacemaker::params
ensure_resource('package', $::pacemaker::params::pcmk_remote_package_list, {
ensure => present
})
# pacemaker remote needs pcsd only with pcs >= 0.10
if $use_pcsd {
include ::pacemaker::install
include pacemaker::install
if $manage_fw {
firewall { '001 pcsd':
proto => 'tcp',
@ -85,7 +85,7 @@ class pacemaker::remote (
path => $::pacemaker::params::pcsd_sysconfig,
line => "PCSD_DEBUG=${pcsd_debug_str}",
match => '^PCSD_DEBUG=',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Service['pcsd'],
}
@ -95,7 +95,7 @@ class pacemaker::remote (
path => $::pacemaker::params::pcsd_sysconfig,
line => "PCSD_BIND_ADDR='${pcsd_bind_addr}'",
match => '^PCSD_BIND_ADDR=',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Service['pcsd'],
}
@ -105,7 +105,7 @@ class pacemaker::remote (
ensure => absent,
path => $::pacemaker::params::pcsd_sysconfig,
match => '^PCSD_BIND_ADDR=*',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
notify => Service['pcsd'],
match_for_absence => true,
@ -117,7 +117,7 @@ class pacemaker::remote (
path => $::pacemaker::params::pcmk_sysconfig,
line => "PCMK_tls_priorities=${tls_priorities}",
match => '^PCMK_tls_priorities=',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
}
}
@ -125,7 +125,7 @@ class pacemaker::remote (
user { $pcs_user:
password => pw_hash($pcs_password, 'SHA-512', fqdn_rand_string(10)),
groups => 'haclient',
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
before => Service['pcsd'],
}
# only set up pcsd, not the other cluster services which have
@ -136,7 +136,7 @@ class pacemaker::remote (
hasstatus => true,
hasrestart => true,
enable => true,
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
}
Service<| title == 'pcsd' |> -> Pcmk_constraint<||>
Service<| title == 'pcsd' |> -> Pcmk_resource<||>

View File

@ -129,7 +129,7 @@ define pacemaker::resource::service(
$deep_compare = false,
$update_settle_secs = hiera('pacemaker::resource::service::update_settle_secs', 600),
) {
include ::pacemaker::params
include pacemaker::params
$res = "pacemaker::resource::${::pacemaker::params::services_manager}"
create_resources($res,

View File

@ -51,7 +51,7 @@ class pacemaker::service (
$hasrestart = true,
$enable = true,
) {
include ::pacemaker::params
include pacemaker::params
if $::pacemaker::params::pcsd_mode {
# only set up pcsd, not the other cluster services which have
@ -62,14 +62,14 @@ class pacemaker::service (
hasstatus => $hasstatus,
hasrestart => $hasrestart,
enable => $enable,
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
}
# The idempotent version of pcs cluster enable, which whas enable
# unconditionally.
service { ['corosync', $::pacemaker::params::service_name]:
enable => true,
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
tag => 'pcsd-cluster-service',
}
} else {
@ -78,7 +78,7 @@ class pacemaker::service (
hasstatus => $hasstatus,
hasrestart => $hasrestart,
enable => $enable,
require => Class['::pacemaker::install'],
require => Class['pacemaker::install'],
}
}
}