diff --git a/lib/facter/tuned.rb b/lib/facter/tuned.rb index 7685f76..e1a084a 100644 --- a/lib/facter/tuned.rb +++ b/lib/facter/tuned.rb @@ -10,8 +10,11 @@ out = Facter::Core::Execution.exec('tuned --version 2>&1') if out && out =~ %r{^tuned ([\d\.]+)$}i Regexp.last_match(1) - elsif !Facter::Core::Execution.exec('which tuned 2>/dev/null').empty? - 'unknown' + else + out = Facter::Core::Execution.exec('which tuned 2>/dev/null') + if ! out || out.empty? + 'unknown' + end end end end @@ -33,7 +36,7 @@ ] alternatives.each do |fn| - if FileTest.exists?(fn) && !File.empty?(fn) + if File.exist?(fn) && !File.empty?(fn) result = File.foreach(fn).first.chomp break end diff --git a/manifests/init.pp b/manifests/init.pp index f18a2b2..6e587d9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,7 +5,7 @@ Integer $sleep_interval = $tuned::params::sleep_interval, Integer $update_interval = $tuned::params::update_interval, String $majversion = $tuned::params::majversion, - Variant[Stdlib::Compat::Absolute_path, String[0,0]] $main_conf = $tuned::params::main_conf, + Variant[Stdlib::Absolutepath, String[0,0]] $main_conf = $tuned::params::main_conf, Stdlib::Absolutepath $profiles_path = $tuned::params::profiles_path, String $active_profile_conf = $tuned::params::active_profile_conf, Array[String, 1] $packages = $tuned::params::packages, diff --git a/manifests/install.pp b/manifests/install.pp index 392871b..b51eab6 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -4,7 +4,7 @@ false => absent } - ensure_packages($tuned::packages, { + stdlib::ensure_packages($tuned::packages, { ensure => $_ensure, }) } diff --git a/manifests/params.pp b/manifests/params.pp index bb6d6bf..c7607f2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,7 +4,7 @@ $sleep_interval = 1 $update_interval = 10 - if has_key($facts, 'tuned_version') and $facts['tuned_version'] =~ /^(\d+)\.[\d\.]+$/ { + if 'tuned_version' in $facts and $facts['tuned_version'] =~ /^(\d+)\.[\d\.]+$/ { $_majversion = $1 } else { $_majversion = undef