X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=lib%2Ffacter%2Fapt_updates.rb;h=014782eab2edaa33c5f29f79bac19d81a901d7da;hb=c4899127eed50ef0998061f5a66d855f355b2109;hp=75670bc39767280c0d8fbd2ddfa7121ded3ffe30;hpb=d090ae4ebb9041bc46e161f698732a6bc9d28399;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/lib/facter/apt_updates.rb b/lib/facter/apt_updates.rb index 75670bc..014782e 100644 --- a/lib/facter/apt_updates.rb +++ b/lib/facter/apt_updates.rb @@ -2,11 +2,16 @@ 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_check_result = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>&1') + if not apt_check_result.nil? and apt_check_result =~ /^\d+;\d+$/ + apt_package_updates = apt_check_result.split(';') + end end setcode do - apt_package_updates != ['0', '0'] unless apt_package_updates.nil? + if not apt_package_updates.nil? and apt_package_updates.length == 2 + apt_package_updates != ['0', '0'] + end end end