Skip to content

Instantly share code, notes, and snippets.

@GregSutcliffe
Created October 13, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GregSutcliffe/b3421aeaff5b06e6d9efbb04f3cabba6 to your computer and use it in GitHub Desktop.
Save GregSutcliffe/b3421aeaff5b06e6d9efbb04f3cabba6 to your computer and use it in GitHub Desktop.
# These facts don't update pkg database (apt-get update, pacman -Sy, etc)
# Make sure that part is handled by cron, as it can take a while
# Archlinux
Facter.add('pkg_updates') do
confine :operatingsystem => 'Archlinux'
setcode do
Facter::Core::Execution.exec('/usr/bin/pacman -Qu|/usr/bin/wc -l')
end
end
# Debian
Facter.add('pkg_updates') do
confine :osfamily => 'Debian'
setcode do
Facter::Core::Execution.exec("/usr/bin/aptitude search '~U' | /usr/bin/wc -l")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment