max
max

Reputation: 10464

chef copying a directory

I'm trying to copy a directory from one folder to another folder like so:

directory "C:\\test\\go" do
  recursive true
  action :create
end

cookbook_file "C:\\Automation" do
  source "C:\\Automation"
  path "C:\\test\\go"
  action :create_if_missing
end

It creates the target folder C:\test\go but does not copy anything. The documentation says that it should also handle directories so any ideas why it does not? I've also tried a wildcard source "C:\Automation\*" and also tried forward slashed...

Upvotes: 0

Views: 4737

Answers (1)

max
max

Reputation: 10464

Here is the solution:

ruby_block "get the windows resources" do
  block do
    FileUtils.mkdir_p mod_path
    FileUtils.cp_r(Dir["#{RESOURCE_DIR}/*.exe"], Chef::Config[:file_cache_path])
  end
end

Upvotes: 2

Related Questions