Ignore:
Timestamp:
Aug 1, 2017, 3:45:14 PM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, debian/jessie
Children:
ce0f6a4
Parents:
bcf0be5 (diff), cd0f9cc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into debian/jessie

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/puppetcode/environments/gnuboat/modules/apt/lib/facter/apt_updates.rb

    rbcf0be5 rad28f83  
    22Facter.add("apt_has_updates") do
    33  confine :osfamily => 'Debian'
    4   if File.executable?("/usr/lib/update-notifier/apt-check")
    5     apt_check_result = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check 2>&1')
    6     if not apt_check_result.nil? and apt_check_result =~ /^\d+;\d+$/
    7       apt_package_updates = apt_check_result.split(';')
     4  if File.executable?("/usr/bin/apt-get")
     5    apt_get_result = Facter::Util::Resolution.exec('/usr/bin/apt-get -s upgrade 2>&1')
     6    if not apt_get_result.nil?
     7      apt_package_updates = [[], []]
     8      apt_get_result.each_line do |line|
     9        if line =~ /^Inst\s/
     10          package = line.gsub(/^Inst\s([^\s]+)\s.*/, '\1').strip
     11          apt_package_updates[0].push(package)
     12          security_matches = [
     13            / Debian[^\s]+-updates /,
     14            / Debian-Security:/,
     15            / Ubuntu[^\s]+-security /,
     16            / gNewSense[^\s]+-security /
     17          ]
     18          re = Regexp.union(security_matches)
     19          if line.match(re)
     20            apt_package_updates[1].push(package)
     21          end
     22        end
     23      end
    824    end
    925  end
    … …  
    1127  setcode do
    1228    if not apt_package_updates.nil? and apt_package_updates.length == 2
    13       apt_package_updates != ['0', '0']
     29      apt_package_updates != [[], []]
    1430    end
    1531  end
    … …  
    1935  confine :apt_has_updates => true
    2036  setcode do
    21     packages = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check -p 2>&1').split("\n")
    2237    if Facter.version < '2.0.0'
    23       packages.join(',')
     38      apt_package_updates[0].join(',')
    2439    else
    25       packages
     40      apt_package_updates[0]
    2641    end
    2742  end
    … …  
    3146  confine :apt_has_updates => true
    3247  setcode do
    33     Integer(apt_package_updates[0])
     48    Integer(apt_package_updates[0].length)
    3449  end
    3550end
    … …  
    3853  confine :apt_has_updates => true
    3954  setcode do
    40     Integer(apt_package_updates[1])
     55    Integer(apt_package_updates[1].length)
    4156  end
    4257end
Note: See TracChangeset for help on using the changeset viewer.