Installing Gems


#1

So I am trying to install a gem via Chef like so (just like their doc says),

cookbook_file “#{Chef::Config[:file_cache_path]}/pony.gem” do
source "pony.gem"
backup false
mode "0755"
end

gem_package “pony” do
action :install
source "#{Chef::Config[:file_cache_path]}/pony.gem"
end

But when I run chef-client I get this,

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on
or after 2011-11-01.
Gem.source_index called from
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/provider/package/rubygems.rb:202.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be
removed on or after 2011-11-01.
Gem::SourceIndex#search called from
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/provider/package/rubygems.rb:76.

Running to irb and doing a quick require says that it can’t find the gem
either.


#2

On Thursday, October 20, 2011 at 10:57 AM, bjbq4d@gmail.com wrote:

So I am trying to install a gem via Chef like so (just like their doc says),

cookbook_file “#{Chef::Config[:file_cache_path]}/pony.gem” do
source "pony.gem"
backup false
mode "0755"
end

gem_package “pony” do
action :install
source "#{Chef::Config[:file_cache_path]}/pony.gem"
end

But when I run chef-client I get this,

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on
or after 2011-11-01.
Gem.source_index called from
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/provider/package/rubygems.rb:202.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be
removed on or after 2011-11-01.
Gem::SourceIndex#search called from
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/provider/package/rubygems.rb:76.
These deprecation warnings are harmless, though Ian Meyer is working on a fix. The challenge here is that we have to maintain support for older versions of rubygems while using new APIs. You can ignore them though.

Running to irb and doing a quick require says that it can’t find the gem
either.
To use a gem within Chef after installing it, you need to clear rubygems’ cache with Gem.clear_paths; see also: http://www.opscode.com/blog/2009/06/01/cool-chef-tricks-install-and-use-rubygems-in-a-chef-run/

Also, Chef will install a gem to the same local gem repo that Chef is running under; do you have more than one installation of rubygems?

Finally, it’s possible there’s a bug, but we’ll need to see more of your logs (preferably in debug mode) to tell.


Dan DeLeo


#3

It seems it was being installed, irb was for some reason having troubles
loading it.

Bryan

On Thu, Oct 20, 2011 at 1:20 PM, Daniel DeLeo dan@kallistec.com wrote:

On Thursday, October 20, 2011 at 10:57 AM, bjbq4d@gmail.com wrote:

So I am trying to install a gem via Chef like so (just like their doc
says),

cookbook_file “#{Chef::Config[:file_cache_path]}/pony.gem” do
source "pony.gem"
backup false
mode "0755"
end

gem_package “pony” do
action :install
source "#{Chef::Config[:file_cache_path]}/pony.gem"
end

But when I run chef-client I get this,

NOTE: Gem.source_index is deprecated, use Specification. It will be
removed on
or after 2011-11-01.
Gem.source_index called from

/usr/lib64/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/provider/package/rubygems.rb:202.

NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will
be
removed on or after 2011-11-01.
Gem::SourceIndex#search called from

/usr/lib64/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/provider/package/rubygems.rb:76.
These deprecation warnings are harmless, though Ian Meyer is working on a
fix. The challenge here is that we have to maintain support for older
versions of rubygems while using new APIs. You can ignore them though.

Running to irb and doing a quick require says that it can’t find the gem
either.
To use a gem within Chef after installing it, you need to clear rubygems’
cache with Gem.clear_paths; see also:
http://www.opscode.com/blog/2009/06/01/cool-chef-tricks-install-and-use-rubygems-in-a-chef-run/

Also, Chef will install a gem to the same local gem repo that Chef is
running under; do you have more than one installation of rubygems?

Finally, it’s possible there’s a bug, but we’ll need to see more of your
logs (preferably in debug mode) to tell.


Dan DeLeo