- From: Adam Jacob <
>
- To:
- Subject: [chef] Re: Re: Re: Re: resource for copy local file?
- Date: Wed, 31 Aug 2011 16:17:32 -0700
This is a quick, untested hack - but stick this in a library in a
cookbook, and use it like the gist says, and you should get the copy
behavior you want.
https://gist.github.com/1185022
Adam
On Wed, Aug 31, 2011 at 12:23 PM, Charles Duffy
<
>
wrote:
>
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
>
>
--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E:
Archive powered by MHonArc 2.6.16.