[chef] Re: chef_gem vs. gem_package


Chronological Thread 
  • From: "Scott M. Likens" < >
  • To:
  • Subject: [chef] Re: chef_gem vs. gem_package
  • Date: Mon, 05 Aug 2013 10:25:39 -0700

Sam,

Sounds like http://docs.opscode.com/resource.html is a bit off. Perhaps my history is off, but if I recall chef_gem was created as a helper to install the gem during the compilation phase and reload the gem path so you can load said gem in your cookbook.

Reviewing https://github.com/opscode/chef/blob/11.6.0/lib/chef/resource/chef_gem.rb#L43-49 does appear to make this assumption true. chef_gem is using the same resource to install gems, it just has the after command to reload the gem path.

https://github.com/opscode/chef/blob/11.6.0/lib/chef/resource/gem_package.rb

So you use gem_package if you want the gem installed during the regular cookbook run; if you need to use the gem in your cookbooks you should use chef_gem.

Yeah it sounds like there's a documentation ticket in the brew for this resource, at least my knowledge conflicts with the documentation.

Scott


On 8/5/13 5:31 AM, Sam Darwin wrote:
from the documentation:

Warning
The chef_gem and gem_package resources are both used to install Ruby gems. For
any machine on which Chef is installed, there are two instances of Ruby. One 
is
the standard, system-wide instance of Ruby and the other is a dedicated
instance that is available only to Chef. Use the chef_gem resource to install
gems into the instance of Ruby that is dedicated to Chef. Use the gem_package
resource to install all other gems (i.e. install gems system-wide).

from observation:

gem_package will fall-back to chef_gem behavior if ruby isn't on the system.
have you seen this?  Am I imagining it?     The problem is that you don't get
consistent results from a recipe.   If one machine has a system ruby 1.8,
another machine has chef-client (with ruby 1.9) and no system ruby, very
different things can happen with the same recipe.     Should the meaning of
chef_gem vs. gem_package , and the differences between them,  be more 
enforced?

!DSPAM:51ff9b3b321631804284693!





Archive powered by MHonArc 2.6.16.

§