I am trying to implement the below wget
download command using chef remote_file
resource. But I couldn't find a way to avoid the re-directions. The URL that I am trying to access may sometimes be redirected to my ISP bill reminder page. And chef remote_file
resource downloads this bill reminder HTML page as a zip file.
wget -N --max-redirect=0 http://www.someurl.com/file.zip
The chef recipe resource is
remote_file "#{node['download-zip-path']}/#{zip}" do
source "http://www.someurl.com/#{zip}"
action :create
notifies :run, 'execute[unzip_file]', :delayed
end
The --max-redirect=0
flag in wget
makes sure that there isn't any redirection to ISP page. I can achieve the same using ruby's open-uri
or execute
command resource but is there any native chef way to achieve this no/zero re-direction?