puppet-archive
puppet-archive copied to clipboard
Unable to download from an artifactory host with X-JFrog-Art-Api Header
We have to use a protected artifactory to download a package, the only option is to use X-JFrog-Art-Api Header, user+pass would be 2FA protected, so will not work.
- Puppet: 7.1.2
- Ruby:
- Distribution: ubuntu
- Module version: master
How to reproduce (e.g Puppet code you use)
Try to use download_options with a X-JFrog-Art-Api Header (which I understood should be usable for that ?)
archive { "package.tar.gz":
ensure => present,
path => $target_file,
source => "${artifactory_url}/${repo}/${branch}/package.tar.gz",
checksum_type => 'md5',
checksum_verify => $package_md5,
checksum_url => "$artifactory_url}/${repo}/${branch}/package.tar.gz.md5",
download_options => "-H \"X-JFrog-Art-Api: ${token}\"",
}
What are you seeing
Error: /Stage[main]/Application::Deployer/Archive[package.tar.gz]/ensure: change from 'absent' to 'present' failed: Execution of '/usr/bin/curl https://artifactory/artifactory/.../...../package.tar.gz -o /srv/tmp_deployment/package.tar.gz_20210617-72402-a7acae -fsSLg --max-redirs 5 -H "X-JFrog-Art-Api: XXXXXXXXXXXXX"' returned 22: curl: (22) The requested URL returned error: 401 Unauthorized
What behaviour did you expect instead
Working
Output log
see above
Any additional information you'd like to impart
When copying the whole command line to bash as-is, downloading works (??)
sorry for bad code insertion, seems I am unable to format it correctly ..
Considering someone might be using Windows and download_options
has "no effect" on underlying ruby client might need a way to make this work on Windows too when coming up with a fix:
https://github.com/voxpupuli/puppet-archive#download-customizations
@Simoliv if you modify your download_options
you can make this work:
archive { "package.tar.gz":
ensure => present,
path => $target_file,
source => "${artifactory_url}/${repo}/${branch}/package.tar.gz",
checksum_type => 'md5',
checksum_verify => $package_md5,
checksum_url => "$artifactory_url}/${repo}/${branch}/package.tar.gz.md5",
download_options => "-H \"Authorization: Bearer ${token}\"",
}