I extend this a bit in some of my facts to check that the gem is available before using it. That way if the gem can't be loaded (normally because it isn't installed), it will still return a value that I can use in the manifests.
Facter.add("ibmim_installed_version") do setcode do ibmim_version = 0 if Gem.available?('headless') require 'headless' < cut code> end ibmim_version end end On 18 May 2011 02:52, Matt Robinson <m...@puppetlabs.com> wrote: > require 'rubygems' > require 'yourgemname' > > That should be enough. You're going to have to start giving more info > you want more help. At the very least the gem name. Sometimes you > think you're requiring the gem correctly based on the gem name, but > the thing you need to require might not match the gem name exactly. > For example, there's an rspec-core gem, but you don't do "require > 'rspec-core'", you do "require 'rspec/core'". > > This really shouldn't be a facter issue, it's a ruby issue. Try just > putting the requires in an empty file and using ruby to run that. If > it works there and doesn't in the facter code, paste your code into a > gist so that people can see the whole thing. > Matt > > On Fri, May 13, 2011 at 9:49 AM, Pietro Monteiro > <pie...@deckmonitoring.com> wrote: > > On 05/13/2011 07:55 AM, Patrick wrote: > >> > >> Facter is run on the clients. Does installing that gem on the clients > fix > >> the error? > >> > > > > Also, "require 'rubygems'" on the top of the file where you define your > > facter. > > > > -- > > Pietro Monteiro > > Senior Developer > > DECK Monitoring > > 115 W 8th Ave. Eugene, Oregon 97401 > > Office: 541-343-0110 > > www.deckmonitoring.com > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/puppet-users?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.