Skip to content

Instantly share code, notes, and snippets.

@nvalentine-puppetlabs
Created January 16, 2013 00:25
Show Gist options
  • Save nvalentine-puppetlabs/4543503 to your computer and use it in GitHub Desktop.
Save nvalentine-puppetlabs/4543503 to your computer and use it in GitHub Desktop.
package_versions.rb
IO.popen('yum list installed -q').readlines.each do | yum_line |
name, version, stuff = yum_line.split(/\s+/)
name.gsub!(/\.(i386|i686|x86_64|noarch)/,'')
Facter.add("yum_#{name}_version") do
setcode do
version
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment