Is there a way to see find out if a module is installed for use?

13 views
Skip to first unread message

Peter Foley

unread,
Apr 29, 2012, 3:42:47 AM4/29/12
to puppet...@googlegroups.com
Hi List,

Is there a puppet command to find out what modules are available for use or at least a module to return a boolean value if you pass it a module name you wish to use?

I am looking to do something like:

if is_module_available(stdlib) {
  # Use stdlib capability
}
else {
  # Use my own version
}

Thanks,

Peter

Len Rugen

unread,
Apr 29, 2012, 4:00:38 PM4/29/12
to puppet...@googlegroups.com
I've used something like this:

Facter.add(:zabbix_version) do
  setcode do
    output = %x{/bin/rpm -qa --queryformat "%{VERSION}" zabbix-agent}
  end
end

But rpm queries can be expensive. 

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Peter

unread,
Apr 30, 2012, 7:57:30 AM4/30/12
to Puppet Users
Hi Len,

Thanks for the reply, sorry I should have been a bit clearer I
actually meant puppet modules.

Ie I want to be able to establish if a puppet module is installed in
the one of the modulepath locations

root@core modules/puppet# puppet config print modulepath
/etc/puppet/modules:/usr/share/puppet/modules

I guess I could go down a similar path and write a fact to query the
module directories and then query against this. Any other
suggestions?

Thanks,

Peter
Reply all
Reply to author
Forward
0 new messages