From 41be4c9b05b95fc0326ec19ebae0fdffea151f7c Mon Sep 17 00:00:00 2001 From: Eric Badger Date: Mon, 19 Aug 2013 18:20:46 -0500 Subject: Use Facter::Util::Resolution.which instead of `which ...` If this plugin is synced to systems without the 'which' executable, backticked which will cause error messages. --- lib/facter/acpi_available.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/facter') diff --git a/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb index 9a0474f..dae057f 100644 --- a/lib/facter/acpi_available.rb +++ b/lib/facter/acpi_available.rb @@ -1,7 +1,7 @@ # return whether acpi is available -- used for deciding whether to install the munin plugin Facter.add("acpi_available") do setcode do - if not File.exist? `which acpi 2>/dev/null`.chomp or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? + if not Facter::Util::Resolution.which('acpi') or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? "absent" else "present" -- cgit v1.2.3