Ask Your Question

Using rest-client in puppet report processor

asked 2014-05-06 15:22:19 -0600

cabish gravatar image

I've written a custom report processor which uses the rest-client gem. Based on the logs it looks like the gem cannot be loaded when the processor runs:

2014-05-06 19:47:52 +0000 Puppet (info): You need the `rest_client` gem to use the report - RUBY is **1.9.3p484**
2014-05-06 19:47:52 +0000 Puppet (debug):       Error: REST call generated an error: uninitialized constant RestClient
["/var/puppet/modules/puppet-myreport/lib/puppet/reports/myreport.rb:98:in `rest_call'

This comes from the code here:

  require 'rest_client'
rescue LoadError => e "You need the `rest_client` gem to use the report - RUBY is #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"

and here:

response =

I have added the gem to the included version of ruby.

[root@SERVER etc]# /opt/puppet/bin/ruby -v
ruby **1.9.3p484** (2013-11-22 revision 43786) [x86_64-linux]
[root@SERVER etc]# /opt/puppet/bin/gem list

*** LOCAL GEMS ***

bundler (1.6.2)
bundler-unload (1.0.2)
childprocess (0.5.3)
commonwatir (4.0.0)
executable-hooks (1.3.1)
ffi (1.9.3)
gem-wrappers (1.2.4)
json (1.8.1)
mime-types (2.2)
multi_json (1.9.3)
netrc (0.7.7)
rdoc (4.1.1)
**rest-client (1.6.7)**
rubygems-bundler (1.4.3)
rubyzip (1.1.3)
rvm (
selenium-webdriver (2.41.0)
watir (5.0.0)
watir-webdriver (0.6.9)
websocket (1.0.7)

It looks like my require fails and then, for obvious reasons, RestClient causes an error. I looked at the example report processors and see gems being used in those so I assumed I could load gems from puppet's version of ruby in the my processor. I'm stumped and could use a little help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-08 12:43:22 -0600

cabish gravatar image

An rvm install altered my gem path. I removed rvm and it worked fine.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-05-06 15:22:19 -0600

Seen: 273 times

Last updated: May 08 '14