[chef] Re: Re: Using ruby_block


Chronological Thread 
  • From: Sachin Sagar Rai < >
  • To:
  • Subject: [chef] Re: Re: Using ruby_block
  • Date: Sun, 27 Jan 2013 01:32:26 +0545

Well @Daniel, I've been doing that way already and using the chef_gem resource and ordered execution of recipes.

I was trying to get feedback whether I'm going in the wrong direction.
Thanks 

-------------------------------------------
@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com
Sent with Sparrow

On Sunday, January 27, 2013 at 1:27 AM, Daniel DeLeo wrote:


On Saturday, January 26, 2013 at 3:56 AM, Sachin Sagar Rai wrote:

Ohai! chefs!

My Recipe has to import from S3, extract and seed the data from the mysqldump.

To do this, I want it using ruby and the aws-sdk gem.
AFAIK, the ruby code in the recipe file is evaluated at compil time and the ones that are inside `ruby_block` is evaluated at convergence time.
So if I do `require 'aws'`, it won't since its not installed. When I add it inside the ruby_block, it errors out.
So to fix it, I used the `chef_gem 'aws-sdk'`, but this will run at the compile time which is fine.
But to install it, it depends on packages like lib-xml2 to be installed too at the compile time.

You can either continue the arms race of moving resources to compile time, which means you probably need to install build-essentials, libxml2-dev, etc. at compile time, too, or you can split your recipe into smaller bits and put each piece at an appropriate place in the run_list, which might look like this:

1. build-essential
2. aws::install_gem (would install libxml2-dev or you could put that in a different recipe before this one if you want)
3. recipe that does things with aws gem be anywhere after this in your run_list

-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§