From 0c043fd73b6bb65b3f49f7c72595078cec7747cb Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Fri, 23 Jun 2023 11:43:22 -0700 Subject: [PATCH] fix puppet-lint errors --- .fixtures.yml | 2 +- manifests/init.pp | 6 +++--- manifests/params.pp | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index efa1def..4e6a843 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,4 +3,4 @@ fixtures: repositories: stdlib: repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' - ref: '4.6.0' + ref: 'v8.6.0' diff --git a/manifests/init.pp b/manifests/init.pp index e4e67f3..7cfd567 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -139,7 +139,7 @@ validate_array($devices) validate_string($mail_to) validate_re($warning_schedule, '^daily$|^once$|^diminishing$|^exec$', - '$warning_schedule must be either daily, once, diminishing, or exec.') + '$warning_schedule must be either daily, once, diminishing, or exec.') if $warning_schedule == 'exec' { if $exec_script == false { fail('$exec_script must be set when $warning_schedule is set to exec.') @@ -194,7 +194,7 @@ file { $config_file: ensure => $file_ensure, owner => 'root', - group => $::gid, + group => fact('identity.group'), mode => '0644', content => template('smartd/smartd.conf'), require => Package[$package_name], @@ -202,7 +202,7 @@ # Special sauce for Debian where it's not enough for the rc script # to be enabled, it also needs its own extra special config file. - if $::osfamily == 'Debian' { + if fact('os.family') == 'Debian' { $debian_augeas_changes = $svc_enable ? { false => 'remove start_smartd', default => 'set start_smartd "yes"', diff --git a/manifests/params.pp b/manifests/params.pp index c6cc619..bf53e05 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,9 +24,9 @@ $exec_script = false $default_options = undef - $version_string = $::smartmontools_version ? { + $version_string = fact('smartmontools_version') ? { undef => '0.0', - default => $::smartmontools_version, + default => fact('smartmontools_version'), } # smartd.conf < 5.43 does not support the 'DEFAULT' directive @@ -36,20 +36,20 @@ $enable_default = false } - case $::osfamily { + case fact('os.family') { 'FreeBSD': { $config_file = '/usr/local/etc/smartd.conf' $service_name = 'smartd' } 'RedHat': { - $config_file = $::operatingsystem ? { + $config_file = fact('os.name') ? { # lint:ignore:80chars - 'Fedora' => $::operatingsystemrelease ? { + 'Fedora' => fact('os.release.full') ? { # No, I am not going to support versions 1-9. /10|11|12|13|14|15|16|17|18/ => '/etc/smartd.conf', default => '/etc/smartmontools/smartd.conf', }, - /RedHat|CentOS|Scientific|SLC|OracleLinux|OEL|Rocky/ => $::operatingsystemmajrelease ? { + /RedHat|CentOS|Scientific|SLC|OracleLinux|OEL|Rocky/ => fact('os.release.major') ? { /4|5|6/ => '/etc/smartd.conf', default => '/etc/smartmontools/smartd.conf', }, @@ -67,7 +67,7 @@ $service_name = 'smartmontools' } default: { - fail("Module ${module_name} is not supported on ${::operatingsystem}") + fail("Module ${module_name} is not supported on fact('os.name')}") } } }