【发布时间】:2019-01-19 02:04:24
【问题描述】:
我一直在尝试使用 chef remote_file 资源实现以下 wget 下载命令。但我找不到避免重定向的方法。
wget -N --max-redirect=0 http://www.someurl.com/file.zip
wget 中的 --max-redirect=0 标志确保没有任何重定向。
下载网址有时会重定向到 ISP 账单提醒页面。 Chef remote_file 资源将此账单提醒 html 页面下载为 zip 文件。
我可以通过包装将命令添加到执行资源中。或者使用带有 open-uri/net-http 的 ruby-block 来实现。
command "wget -N --max-redirect=0 http://www.someurl.com/file.zip"
但是有没有类似 Chef 的实现将重定向设置为零或假?
我的厨师食谱资源块是
remote_file "#{node['download-zip-path']}/#{zip}" do
source "http://www.someurl.com/#{zip}"
action :create
notifies :run, 'execute[unzip_file]', :delayed
end
【问题讨论】:
标签: chef-infra chef-recipe chef-solo