Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Workaround remote_file not supporting 404's and utilize archive_url
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Mar 31, 2014
1 parent a5094ef commit 3a84f6b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.1

* Bugfix: Workaround remote_file not supporting 404's and utilize archive_url

## 0.7.0

* Enhancement: Update J default version to 5.1.29
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'Apache 2.0'
description 'Recipes/LWRPs for installing MySQL Connectors.'
version '0.7.0'
version '0.7.1'
recipe 'mysql_connector', 'Empty recipe'
recipe 'mysql_connector::j', 'Installs MySQL Connector/J via attribute.'
recipe 'mysql_connector::odbc_package', 'Installs MySQL Connector/ODBC via package.'
Expand Down
21 changes: 20 additions & 1 deletion providers/j.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,31 @@
#

remote_file "#{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}" do
source [node['mysql_connector']['j']['url'], node['mysql_connector']['j']['archive_url']]
source node['mysql_connector']['j']['url']
checksum node['mysql_connector']['j']['checksum']
mode 00644
ignore_failure true
action :create
end

# BEGIN: This is workaround for remote_file not supporting 404's
# This is after various attempts at begin/rescue and requires ignore_failure above.
remote_file "#{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}-archive_url" do
source node['mysql_connector']['j']['archive_url']
checksum node['mysql_connector']['j']['checksum']
mode 00644
not_if "test -s #{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}"
action :create
end

execute 'mysql_connector_j_mv_archive_url' do
cwd Chef::Config[:file_cache_path]
command "mv #{node['mysql_connector']['j']['tar_file']}-archive_url #{node['mysql_connector']['j']['tar_file']}"
not_if "test -s #{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}"
action :run
end
# END: This is workaround for remote_file not supporting 404's

execute "mysql-connector-java-#{new_resource.path}" do
cwd Chef::Config[:file_cache_path]
command "tar --strip-components=1 -xzf #{node['mysql_connector']['j']['tar_file']} -C #{new_resource.path} mysql-connector-java-#{node['mysql_connector']['j']['version']}/#{node['mysql_connector']['j']['jar_file']}"
Expand Down

0 comments on commit 3a84f6b

Please sign in to comment.