Reputation: 101
I'm trying to use windows_zipfile
resource from the Chef Supermarket windows cookbook, but the source URL that I am using needs to have user privilege's to fetch any artifacts.
How can we add username and password to windows_zipfile
resource?
windows_zipfile 'c:\test_app' do
source 'https://artifactory/repoName/ApplicationName/zipfile.zip'
action :unzip
end
Upvotes: 1
Views: 300
Reputation: 7340
The windows_zipfile
custom resource does not have any properties to accept credentials for the URL. More importantly the cookbook as a whole is being deprecated in favour of the native archive_file
resource.
Note: This resource has been deprecated as Chef Infra Client 15.0 shipped with a new archive_file resource, which natively handles multiple archive formats. Please update any cookbooks using this resource to instead use the
archive_file
resource.
I would recommend downloading the file using remote_file resource by providing the credentials. Then you can use archive_file
(if Chef version > 15), or windows_zipfile
to extract the file from local path.
remote_file 'C:\test_app.zip' do
source 'https://artifactory/repoName/ApplicationName/zipfile.zip'
remote_user 'user'
remote_password 'secret'
end
# showing example for 'archive_file'
archive_file 'C:\test_app' do
source 'C:\test_app.zip'
action :extract
end
Upvotes: 2