[chef] Re: Re: Re: resource for copy local file?


Chronological Thread 
  • From: Charles Duffy < >
  • To:
  • Subject: [chef] Re: Re: Re: resource for copy local file?
  • Date: Wed, 31 Aug 2011 14:23:44 -0500

No surprise -- the read is happening at compile time, but the remote_file resource is actually _created_ at execution time.

You could force it to run at compile time, I suppose, but the better answer is that trying to use the "content IO.read" approach doesn't make sense if you're trying to read things which prior execution-time resources change.

Anyhow, it's a bad idea for large files, as it means you need to have enough memory to store the whole thing -- not a great pattern to use often.

Perhaps you could implement the copy in a ruby_block resource? That will make it happen at execution time properly.

On Tue, Aug 30, 2011 at 10:29 PM, < "> > wrote:
I still got error: FATAL: Errno::ENOENT: No such file or directory - /httpfile
after I add only_if statement

remote_file "/httpfile" do
   source "http://wiki.opscode.com/display/chef/Home"
   mode "0666"
end
file "/httpfile.bak" do
   content IO.read("/httpfile")
   only_if {File.exists?("/httpfile")}
end

I




Archive powered by MHonArc 2.6.16.

§