Chef/Modernize/PowershellDownloadFile
The Cookstyle cops department: Chef/Modernize
| Enabled by default | Supports autocorrection | Target Chef Version |
|---|---|---|
| Enabled | No | All Versions |
Use the remote_file resource to download files instead of shelling out to PowerShell.
remote_file is idempotent, supports checksum verification, proxies, and conditional
downloads with etags and last-modified headers, none of which a script gets for free.
Examples
# bad
powershell_script 'download the installer' do
code 'Invoke-WebRequest -Uri https://example.com/foo.msi -OutFile C:\foo.msi'
end
# good
remote_file 'C:\foo.msi' do
source 'https://example.com/foo.msi'
end
Configurable attributes
| Name | Default value | Configurable values |
|---|---|---|
| Version Added | 9.0.0 | String |
| Include | Array |