Created
February 15, 2012 22:14
-
-
Save jumanjiman/1839393 to your computer and use it in GitHub Desktop.
generate a facter fact for every package on a host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IO.popen("/bin/rpm -qa --qf='%{name} '").read.split(' ').each do |package| | |
Facter.add("yum_#{package}_version") do | |
setcode do | |
puts IO.popen("/bin/rpm -q --qf=\'%|epoch?{%{epoch}}:{0}|:%{version}-%{release}.%{arch}\' #{package}").read | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment