- Timestamp:
- Aug 1, 2017, 3:45:14 PM (9 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/puppetcode/environments/gnuboat/modules/apt/lib/facter/apt_updates.rb
rbcf0be5 rad28f83 2 2 Facter.add("apt_has_updates") do 3 3 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 8 24 end 9 25 end … … 11 27 setcode do 12 28 if not apt_package_updates.nil? and apt_package_updates.length == 2 13 apt_package_updates != [ '0', '0']29 apt_package_updates != [[], []] 14 30 end 15 31 end … … 19 35 confine :apt_has_updates => true 20 36 setcode do 21 packages = Facter::Util::Resolution.exec('/usr/lib/update-notifier/apt-check -p 2>&1').split("\n")22 37 if Facter.version < '2.0.0' 23 packages.join(',')38 apt_package_updates[0].join(',') 24 39 else 25 packages40 apt_package_updates[0] 26 41 end 27 42 end … … 31 46 confine :apt_has_updates => true 32 47 setcode do 33 Integer(apt_package_updates[0] )48 Integer(apt_package_updates[0].length) 34 49 end 35 50 end … … 38 53 confine :apt_has_updates => true 39 54 setcode do 40 Integer(apt_package_updates[1] )55 Integer(apt_package_updates[1].length) 41 56 end 42 57 end
Note:
See TracChangeset
for help on using the changeset viewer.
