From: Morgan Haskel Date: Mon, 27 Oct 2014 13:57:46 +0000 (-0400) Subject: Merge remote-tracking branch 'upstream/master' into 1.7.x-merge X-Git-Tag: 1.7.0~1^2~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=20ddb6771466e8db0135f74a6ee40fa897632234;p=puppet-modules%2Fpuppetlabs-apt.git Merge remote-tracking branch 'upstream/master' into 1.7.x-merge Conflicts: lib/facter/apt_package_updates.rb lib/facter/apt_security_updates.rb lib/facter/apt_updates.rb --- 20ddb6771466e8db0135f74a6ee40fa897632234 diff --cc lib/facter/apt_updates.rb index 15d9473,75670bc..77e667e --- a/lib/facter/apt_updates.rb +++ b/lib/facter/apt_updates.rb @@@ -1,9 -1,23 +1,23 @@@ - Facter.add("apt_updates") do + apt_package_updates = nil + Facter.add("apt_has_updates") do confine :osfamily => 'Debian' + if File.executable?("/usr/lib/update-notifier/apt-check") - apt_package_updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>&1').split(';') ++ apt_package_updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>/dev/null').split(';') + end + + setcode do + apt_package_updates != ['0', '0'] unless apt_package_updates.nil? + end + end + + Facter.add("apt_package_updates") do + confine :apt_has_updates => true setcode do - if File.executable?("/usr/lib/update-notifier/apt-check") - updates = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>/dev/null') - Integer(updates.strip.split(';')[0]) - packages = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check -p 2>&1').split("\n") ++ packages = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check -p 2>/dev/null').split("\n") + if Facter.version < '2.0.0' + packages.join(',') + else + packages end end end