The chef uses "cookbook_file" as the source for the "windows_zipfile" resource
I'm trying to use the windows_zipfile resource from a "windowed" cookbook, but the file I need to unzip is in files / default in the cookbook I'm running.
Usually I would like to access this file using the cookbook_file resource, how can I get to it using the windows_zipfile resource?
I tried:
windows_zipfile 'c:\test_app' do
source 'files/default/test_app.zip'
action :unzip
end
and got "Files files \ default \ test_zpp.zip not found"
source to share
You need to create the file locally and then run the windows_zipfile resource. You are trying to unzip a file inside your repo, not on node. source
here is a file on the local filesystem.
cookbook_file 'c:/testapp.zip' do
source 'files/default/test_app.zip'
end
windows_zipfile 'c:/test_app' do
source 'c:/testapp.zip'
action :unzip
not_if {::File.exists?('c:/test_app')}
end
^ Also, make sure you have armed not_if
to protect the idempotence (so that every Chef run doesn't try to decompress).
This is mentioned in the Windows cookbook.
source to share