[chef] Re: Re: Re: Re: Re: Re: Re: more of a ruby problem


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: more of a ruby problem
  • Date: Wed, 30 Oct 2013 09:56:02 -0700


On Wednesday, October 30, 2013 at 9:41 AM, Manoj Thakkar wrote:

Thanks Daniel,

What i am trying to achieve is set an array of strings as an attribute or variable inside the ruby block and then use it outside in various chef resource,

How do i do that ? please advise.

Thanks
Manoj
Looking at your recipe code, it looks like you read some file, grep the relevant information out of it, and then you want to create chef resources to configure your system based on the contents. So you you take a deeper look. 

Where does this file come from? Is it managed with Chef? If it comes from some other process, then you could read the file directly in the recipe without using a ruby_block resource.

If, on the other hand, you manage this file with Chef, then you should try to pull the relevant data in the file into chef attributes (or a data bag item or whatever). Then you’ll have all the data you’re trying to extract from the file already available in the compile phase of the chef run and you won’t have to parse the file at all.


-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§