Hello!
On Thu, Sep 22, 2011 at 4:36 AM, Ilya ilya@notarikon.net wrote:
We have a problem. We are trying to copy a file from one folder to
another, using "cookbook_file" using the attribute "path". Example code:
cookbook_file "/opt/server.tgz" do
path "/mnt/server/"
source "server.tgz"
end
"path" is the "name parameter attribute" for cookbook_file,
remote_file, template and file resources, as described in the Resource
documentation0. The name is the string following the resource type.
Above, this is "/opt/server.tgz".
To use the cookbook_file resource, you put the source file in the
'files/default' directory of the cookbook where the recipe is located
and Chef will retrieve it from the server to put into the path
location when it configures the resource on the node.
cookbook_file "/mnt/server/server.tgz" do
source "server.tgz"
end
Will put it in the /mnt/server location as long as the source is in
the cookbook.
If you want to copy a file's contents from one location to another,
you can use the file resource with the content parameter that calls
the Ruby IO object's read method.
file "/mnt/server/server.tgz" do
content IO.read("/opt/server.tgz")
end
The file "/opt/server.tgz" must exist during the compile phase1.
--
Opscode, Inc
Joshua Timberman, Director of Training and Services
IRC, Skype, Twitter, Github: jtimberman