Search code examples
chef-infrarecipe

Opscode Chef: provider remote_file with headers attribute


According to this release: http://docs.opscode.com/release/11-6/release_notes.html#resource-remote-file-attributes

Remote_file provider have the attribute "headers".

I would like to use it like this:

remote_file "foo" do
   source "http://someurl"
   headers({"Cookies" => "Some cookie"})
end

However this is not working as supposed, I mean, headers is not being used i guess. It's that the right sintax?


Solution

  • It's not the solution.. but it's a workaround

    # install wget
    windows_package "wget" do
       source "http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe"
       action :install
    end
    
    # Java uninstall, download and install
    windows_batch "jre-7 installation" do
      code <<-EOH
         WMIC product where "Name LIKE '%%Java 7%%'" call uninstall /nointeractive
         "C:/Program Files (x86)/GnuWin32/bin/wget.exe" -O C:/chef/cache/jre-7.exe --no-check-certificate  --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com;" http://download.oracle.com/otn-pub/java/jdk/7u25-b17/jdk-7u25-windows-x64.exe
          C:/chef/cache/jre-7.exe /s
     EOH
    end