Remove stderr from stdout
authorHunter Haugen <hunter@puppetlabs.com>
Fri, 15 Aug 2014 23:22:46 +0000 (16:22 -0700)
committerMorgan Haskel <morgan@puppetlabs.com>
Mon, 27 Oct 2014 13:49:27 +0000 (09:49 -0400)
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
lib/facter/apt_security_updates.rb
lib/facter/apt_updates.rb

index 97c75c66a2645b0890f9861811aa57244590d317..e2fc96e4b5c3bdd6bb7e195370106ba943cfa440 100644 (file)
@@ -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(',')
index 19bae7521dec9ee20100ba96b0edcfd13b25cf6c..77b3c0e9fcfbf55e833c9b05ca41fa1d6c8a92bc 100644 (file)
@@ -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
index ee177380c231939a12f0d22fd33dbacd4acd3f0c..15d9473d6e63716cfd9048775bc8ca82a6857bdb 100644 (file)
@@ -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