[chef] Re: Re: Re: Re: Bulk expansion of templates


Chronological Thread 
  • From: Maven User < >
  • To: chef < >
  • Subject: [chef] Re: Re: Re: Re: Bulk expansion of templates
  • Date: Thu, 29 Nov 2012 14:35:25 -0500

Hmmm - ok, it's a bit clearer now, but this is an area I'm not familiar with.

Can't I do:

Directory["/path/to/templates/**"].each do |file|
  template /tmp/foo/file do
     local true
     source file
  end
end

??

I'm not sure how to reference the file variable in the actual template resource now tho...

 


On Thu, Nov 29, 2012 at 11:38 AM, Adam Jacob < " target="_blank"> > wrote:
Ack!

Something like this:

remote_file "/srv/app/deploy.zip" do
  source "http://example.com/deploy.zip"
end

execute "unzip /srv/app/deploy.zip"

ruby_block "process templates" do
  source <<-EOH
Directory["/srv/app/templates/**"].each do |file|
  ...
end
EOH
End

Should do the trick (where Š is fill in the blanks).

Adam

On 11/29/12 7:45 AM, "Maven User" < "> > wrote:

>
>
>
>Sure -
>
>So because of the way we structure our deployable units (zip files) we
>wind up supplying templates inside there (maven injects the erb syntax
>into these files).
>
>The structure looks like this:
>
>foo
>|_bin
>|_conf
>|_templates
>   |_bin
>   |_conf
>
>Essentially, I want to take any of the directories inside templates, and
>process the files inside to identical directories one higher.
>
>I don't want to have a hard coded list of templates anywhere.
>
>If this were ant or maven or something, I'd just use something like
>templates/**.
>
>Does this help explain a bit more?  I'm not sure how awesome my ASCII art
>will look like once posted....
>
>
>
>
>On Thu, Nov 29, 2012 at 10:37 AM, Adam Jacob
>< "> > wrote:
>
>I'm actually confused by the question. Can you explain it again, perhaps a
>bit differently, perhaps with a more explicit example of your intent?
>
>Adam
>
>On 11/29/12 7:15 AM, "Maven User" < "> > wrote:
>
>>
>>
>>
>>Hi all -
>>
>>Before I go off the rails and start trying to iterate over "n" number of
>>directories and their contents, is there a great way to say, "hey, in
>>this templates directory, move everything one directory higher (or FQP)"?
>>
>>I don't see any sort of wild carding kinda stuff around the templates or
>>being able to specify a templates directory to be processed.
>>
>>Thanks for any tips.
>>
>>
>
>
>
>
>
>
>
>
>






Archive powered by MHonArc 2.6.16.

§