module-puppetlabs-apt/lib/facter/apt_security_updates.rb
Damien Churchill 7eb9d00360 add facts showing available updates
Making use of the apt-check command from the 'update-notifier-common'
package (if available) display the number of available updates, number of
security updates as well as the update package names.
2014-06-27 11:21:58 +01:00

9 lines
295 B
Ruby

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')
Integer(updates.strip.split(';')[1])
end
end
end