Skip to content

Commit

Permalink
Merge pull request #112 from juliandunn/remove-curl
Browse files Browse the repository at this point in the history
[COOK-4165] Replace curl with remote_file with cookie header
  • Loading branch information
carmstrong committed Jan 3, 2014
2 parents e7ac547 + a21b88d commit c9e4d10
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions providers/ark.rb
Expand Up @@ -64,19 +64,12 @@ def download_direct_from_oracle(tarball_name, new_resource)
jdk_id = new_resource.url.scan(/\/([6789]u[0-9][0-9]?-b[0-9][0-9])\//)[0][0]
cookie = "oraclelicensejdk-#{jdk_id}-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"
if node['java']['oracle']['accept_oracle_download_terms']
# install the curl package
p = package "curl" do
remote_file download_path do
source new_resource.url
checksum new_resource.checksum
headers 'Cookie' => cookie
action :nothing
end
# no converge_by block since the package provider will take care of this run_action
p.run_action(:install)
description = "download oracle tarball straight from the server"
converge_by(description) do
Chef::Log.debug "downloading oracle tarball straight from the source"
cmd = shell_out!(
%Q[ curl --create-dirs -L --cookie "#{cookie}" #{new_resource.url} -o #{download_path} ]
)
end
end.run_action(:create_if_missing)
else
Chef::Application.fatal!("You must set the attribute node['java']['oracle']['accept_oracle_download_terms'] to true if you want to download directly from the oracle site!")
end
Expand Down

0 comments on commit c9e4d10

Please sign in to comment.