[chef] Re: Re: Re: Re: Re: Re: Re: Need to copy a file after installation to another place


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Need to copy a file after installation to another place
  • Date: Thu, 5 Sep 2013 11:41:45 -0700


On Thursday, September 5, 2013 at 8:43 AM, Russell Bateman wrote:

While I'm not convinced that this is impossible in "normal" Chef recipe code, I stumbled upon the idea of just using a script to do it. (I am, after all, new to and still very perplexed by Chef.) Here's what I did to get around my inability to make the "remote file to remote file" copy work:
# Create a script on the fly to copy the mongod daemon for our configuration
# server to run off of. (The latter cannot share /usr/bin/mongod because the
# arbiter is going to be using that one.)
bash "copy-mongod" do
  user "root"
  cwd "/data/mongodb"
  code <<-EOS
  cp /usr/bin/mongod ./bin
  chown mongodb:mongodb ./bin/mongod
  chmod a+x ./bin/mongod
  EOS
end

Thanks for bearing with me on this!

Russ
I think what's confusing you here is the compile phase vs. converge phase. Chef evaluates all of your recipes in one go, which results in an ordered list of resources to converge (the resource collection). Once the resource collection is compiled, Chef goes through the resource collection in order and configures each resource (or not, if it's already configured).

This is (probably) why your implementation like

file "/path/to/copy" do
  content IO.read "path/to/original"
end

didn't work.
 

On 9/4/2013 3:22 PM, Russell Bateman wrote:
No, on the client I'm using 11.4.4-2. My chef server is running 10.18.1.
Copying local files via a "file://" URL requires Chef 11.6.


-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§