diff --git a/providers/ark.rb b/providers/ark.rb index db0b3b14..e9db6aa1 100644 --- a/providers/ark.rb +++ b/providers/ark.rb @@ -67,10 +67,9 @@ def download_direct_from_oracle(tarball_name, new_resource) 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 -L --cookie "#{cookie}" #{new_resource.url} -o #{download_path} ] - ) + FileUtils.mkdir_p Chef::Config[:file_cache_path] + Chef::Log.debug "downloading oracle tarball straight from the source" + cmd = shell_out!(%Q[ curl -L --cookie "#{cookie}" #{new_resource.url} -o #{download_path} ]) end 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!") @@ -134,31 +133,23 @@ def download_direct_from_oracle(tarball_name, new_resource) cp "#{Chef::Config[:file_cache_path]}/#{tarball_name}" . ; bash ./#{tarball_name} -noregister ] ) - unless cmd.exitstatus == 0 - Chef::Application.fatal!("Failed to extract file #{tarball_name}!") - end + cmd.error! when /^.*\.zip/ cmd = shell_out( %Q[ unzip "#{Chef::Config[:file_cache_path]}/#{tarball_name}" -d "#{tmpdir}" ] ) - unless cmd.exitstatus == 0 - Chef::Application.fatal!("Failed to extract file #{tarball_name}!") - end + cmd.error! when /^.*\.(tar.gz|tgz)/ cmd = shell_out( %Q[ tar xvzf "#{Chef::Config[:file_cache_path]}/#{tarball_name}" -C "#{tmpdir}" ] ) - unless cmd.exitstatus == 0 - Chef::Application.fatal!("Failed to extract file #{tarball_name}!") - end + cmd.error! end cmd = shell_out( %Q[ mv "#{tmpdir}/#{app_dir_name}" "#{app_dir}" ] ) - unless cmd.exitstatus == 0 - Chef::Application.fatal!(%Q[ Command \' mv "#{tmpdir}/#{app_dir_name}" "#{app_dir}" \' failed ]) - end + cmd.error! FileUtils.rm_r tmpdir end new_resource.updated_by_last_action(true) @@ -212,9 +203,7 @@ def download_direct_from_oracle(tarball_name, new_resource) converge_by(description) do Chef::Log.debug "Adding alternative for #{cmd}" install_cmd = shell_out("update-alternatives --install #{bin_path} #{cmd} #{alt_path} #{priority}") - unless install_cmd.exitstatus == 0 - Chef::Application.fatal!(%Q[ set alternative failed ]) - end + install_cmd.error! end new_resource.updated_by_last_action(true) end @@ -227,9 +216,7 @@ def download_direct_from_oracle(tarball_name, new_resource) converge_by(description) do Chef::Log.debug "Setting alternative for #{cmd}" set_cmd = shell_out("update-alternatives --set #{cmd} #{alt_path}").run_command - unless set_cmd.exitstatus == 0 - Chef::Application.fatal!(%Q[ set alternative failed ]) - end + set_cmd.error! end new_resource.updated_by_last_action(true) end