Hi,

before I reinvent the wheel:

Does anyone know a custom fact that returns the version of an installed
package (if it is installed)?

I assume it would be something like

Facter.add(:package_version) do
  setcode do
    osfamily = Facter.value(:osfamily)
    case osfamily
    when /ubuntu|debian/
      Facter::Util::Resolution.exec("dpkg -l '*$my_package*' | grep
^ii")
    when 'freebsd'
      Facter::Util::Resolution.exec("pkg info -ix $my_package*")
    end
  end
end

but I have not found out yet how to pass a variable to facter.

helmut@ubuntu:~$ puppet -V
6.4.2
helmut@ubuntu:~$ facter -v
3.13.2
helmut@ubuntu:~$

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/xn0ltx8j23azj63000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to