diff --git a/CHANGELOG.md b/CHANGELOG.md index c2bd097..264eb3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/metadata.rb b/metadata.rb index c5a9e5a..e83f978 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'bflad417@gmail.com' 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.' diff --git a/providers/j.rb b/providers/j.rb index 90f100c..37da9ec 100644 --- a/providers/j.rb +++ b/providers/j.rb @@ -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']}"