Hi, Created a facter that require a gem. The gem is installed on all the servers involved. But when I trigger puppet I get an error in the log: Could not run Puppet configuration client: Could not retrieve local facts: no such file to load -- <gem name> Is there a way to make puppet use/find the gem? Using Puppet 2.6.1 Regard, Patrik -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On May 13, 2011, at 7:05 AM, patant wrote:> Hi, > > Created a facter that require a gem. The gem is installed on all the servers involved. > But when I trigger puppet I get an error in the log: > Could not run Puppet configuration client: Could not retrieve local facts: no such file to load -- <gem name> > > Is there a way to make puppet use/find the gem? > > Using Puppet 2.6.1Facter is run on the clients. Does installing that gem on the clients fix the error? -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
The gem is installed on the clients and the facter works on the client. It''s when I do the puppet apply/run I get the error. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I do require rubygems. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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 <pietro@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Found the error: require ''rubygems'' require ''mygem'' Facter.add("myfacter") do setcode do ------ This works: Facter.add("myfacter") do require ''rubygems'' require ''mygem'' setcode do ------- -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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 <matt@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 > <pietro@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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Good idea! Now I found another problem. Some facts dosent''t works when I call them explicit. The facter shows up in the list when I run facter --puppet. But when I call facter --puppet <facter name> it dosen''t give me the value that I got in the list. Returns nothing. "facter" gives me: ---------- uptime => 2 days uptime_days => 2 uptime_hours => 49 uptime_seconds => 178750 virtual => physical "facter uptime_seconds" gives me nothing. "facter -v" 1.5.6 -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On May 18, 2011, at 1:20 AM, patant wrote:> Good idea! > > > Now I found another problem. > Some facts dosent''t works when I call them explicit. > > The facter shows up in the list when I run facter --puppet. > But when I call facter --puppet <facter name> it dosen''t give me the value that I got in the list. Returns nothing. > > "facter" gives me: > ---------- > uptime => 2 days > uptime_days => 2 > uptime_hours => 49 > uptime_seconds => 178750 > virtual => physical > > "facter uptime_seconds" > gives me nothing.I''ve seen a problem similar to this, and with that problem, the puppet fact works just fine. So I''d test it in puppet and ignore the problem if puppet is fine. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 05/18/2011 05:18 PM, Patrick wrote:> > On May 18, 2011, at 1:20 AM, patant wrote: > >> Good idea! >> >> >> Now I found another problem. >> Some facts dosent''t works when I call them explicit. >> >> The facter shows up in the list when I run facter --puppet. >> But when I call facter --puppet <facter name> it dosen''t give me the value that I got in the list. Returns nothing. >> >> "facter" gives me: >> ---------- >> uptime => 2 days >> uptime_days => 2 >> uptime_hours => 49 >> uptime_seconds => 178750 >> virtual => physical >> >> "facter uptime_seconds" >> gives me nothing. > > I''ve seen a problem similar to this, and with that problem, the puppet fact works just fine. So I''d test it in puppet and ignore the problem if puppet is fine. >IIRC the reason is that the fact doesn''t live in a file called <factname>.rb. Is this the case here? Otherwise I second Patrick''s notion: Ignore the commandline weirdness and go ahead. Regards, Felix -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
If I remove the extension .rb the facter dosen''t work. So that''s not the issue. /Patrik -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.