[chef] Re: Using gem_package in recipes causing strange behavior


Chronological Thread 
  • From: Cassiano Leal < >
  • To:
  • Subject: [chef] Re: Using gem_package in recipes causing strange behavior
  • Date: Tue, 16 Apr 2013 20:46:15 -0300

chef_gem installs the gem in Chef's Ruby, not on the system's.

If I understand you correctly, you want this gem to be available to Chef so that it can be used in your recipe, right?

If that's the case, then that's the right approach: use chef_gem so that it gets installed at compile time in Chef's Ruby so that it can be used later in the recipe.

If the gem is not installed at compile time and then you require it in the recipe, The chef client will throw an exception because it won't find the required class.

-- 
Cassiano Leal

On Tuesday, April 16, 2013 at 19:18, wrote:


I am using a number of gems in my recipes with gem_package such as below:

gem_package 'faraday' do
source "cookbooks/rabbitmq/files/default/faraday-0.8.7.gem"
action :install
end

These gem_package statements are located mid recipe and then I have a "require
'faraday'" straight after, so I can start using the gems in the recipe.

This specific recipe is 3rd out of 4 in the run list. When I run it seems to
skip everything until it gets to the gem_package statements . Why is this
happening? I have tried various different methods such as calling
g.run_action(:install) with no luck.

I was originally using chef_gem and read that it causes gems to be installed at
compile time but gem_package also seems to be doing that too.

Behaviour I am looking for is to install the gem at the point in the recipe
where it is being used.

I am new to chef (in windows) and this has got me stumped so appreciate any
help.




Archive powered by MHonArc 2.6.16.

§