Resource for copy local file?


#1

I got another problem regarding resource for copy local file.
eg. Download one file from http server, then backup the file:

remote_file “/httpfile” do
source “http://wiki.opscode.com/display/chef/Home"
mode “0666"
end
file “/httpfile.bak” do
content IO.read(”/httpfile”)
end

I got error: FATAL: Errno::ENOENT: No such file or directory - /httpfile

This is because /httpfile is non-exist when I start chef-client. How can I copy
such kind of file?


#2

Add an only_if File.exists to the backup

On Aug 30, 2011, at 23:01, "zkfhu@yahoo.com" zkfhu@yahoo.com wrote:

I got another problem regarding resource for copy local file.
eg. Download one file from http server, then backup the file:

remote_file “/httpfile” do
source “http://wiki.opscode.com/display/chef/Home"
mode “0666"
end
file “/httpfile.bak” do
content IO.read(”/httpfile”)
end

I got error: FATAL: Errno::ENOENT: No such file or directory - /httpfile

This is because /httpfile is non-exist when I start chef-client. How can I copy
such kind of file?