[chef] RE: library gem dependencies


Chronological Thread 
  • From: Philippe Bérard < >
  • To: < >
  • Cc: "'Sam Darwin'" < >
  • Subject: [chef] RE: library gem dependencies
  • Date: Tue, 5 Mar 2013 10:32:54 +0100

I don't know if I do it correctly, but here's my answer.

Just do it that way :
chef_gem 'treetop'
require 'treetop'

It will be installed at the right time before being loaded by the recipe.

Regards,

-- Philippe Bérard

-----Message d'origine-----
De : Sam Darwin 
[mailto:
 
Envoyé : mardi 5 mars 2013 10:29
À : 

Objet : [chef] library gem dependencies


Let's say a cookbook library requires a gem called treetop (it could be any
gem actually), and so it has this line:

require 'treetop'

I want to get that installed as a pre-requisite, and so I add this code into
the default recipe:

r = chef_gem "treetop" do
  action :nothing
end
r.run_action(:install)

But apparently it won't get called soon enough.    The library has errors
about
treetop missing.

As another attempt, I create a different cookbook called pre-requisites.  I
add the code "r = chef_gem "treetop" do"  into the pre-requisites cookbook,
and
have that as a cookbook dependency.   Nope.   This also doesn't get called
soon
enough.   treetop is missing.     Installing the treetop gem by hand will
fix
it.      

The issue seems to be with a library and not with a recipe file, that is the
twist.




Archive powered by MHonArc 2.6.16.

§