From ea9f902543e0696286bf55ce2ad8c1818ffd5a84 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 15 Aug 2014 16:22:46 -0700 Subject: [PATCH] Remove stderr from stdout Sometimes there are lib errors on platforms with malformed packages. This shouldn't cause the facts to completely fail. --- lib/facter/apt_package_updates.rb | 2 +- lib/facter/apt_security_updates.rb | 2 +- lib/facter/apt_updates.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/facter/apt_package_updates.rb b/lib/facter/apt_package_updates.rb index 97c75c6..e2fc96e 100644 --- a/lib/facter/apt_package_updates.rb +++ b/lib/facter/apt_package_updates.rb @@ -2,7 +2,7 @@ Facter.add("apt_package_updates") do confine :osfamily => 'Debian' setcode do if File.executable?("/usr/lib/update-notifier/apt-check") - packages = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check -p 2>&1') + packages = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check -p 2>/dev/null') packages = packages.split("\n") if Facter.version < '2.0.0' packages = packages.join(',') diff --git a/lib/facter/apt_security_updates.rb b/lib/facter/apt_security_updates.rb index 19bae75..77b3c0e 100644 --- a/lib/facter/apt_security_updates.rb +++ b/lib/facter/apt_security_updates.rb @@ -2,7 +2,7 @@ Facter.add("apt_security_updates") do confine :osfamily => 'Debian' setcode do if File.executable?("/usr/lib/update-notifier/apt-check") - updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>&1') + updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>/dev/null') Integer(updates.strip.split(';')[1]) end end diff --git a/lib/facter/apt_updates.rb b/lib/facter/apt_updates.rb index ee17738..15d9473 100644 --- a/lib/facter/apt_updates.rb +++ b/lib/facter/apt_updates.rb @@ -2,7 +2,7 @@ Facter.add("apt_updates") do confine :osfamily => 'Debian' setcode do if File.executable?("/usr/lib/update-notifier/apt-check") - updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>&1') + updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>/dev/null') Integer(updates.strip.split(';')[0]) end end -- 2.45.2