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

Commit 3a84f6b

Browse files
committed
Workaround remote_file not supporting 404's and utilize archive_url
1 parent a5094ef commit 3a84f6b

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.1
2+
3+
* Bugfix: Workaround remote_file not supporting 404's and utilize archive_url
4+
15
## 0.7.0
26

37
* Enhancement: Update J default version to 5.1.29

metadata.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
maintainer_email '[email protected]'
44
license 'Apache 2.0'
55
description 'Recipes/LWRPs for installing MySQL Connectors.'
6-
version '0.7.0'
6+
version '0.7.1'
77
recipe 'mysql_connector', 'Empty recipe'
88
recipe 'mysql_connector::j', 'Installs MySQL Connector/J via attribute.'
99
recipe 'mysql_connector::odbc_package', 'Installs MySQL Connector/ODBC via package.'

providers/j.rb

+20-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,31 @@
1313
#
1414

1515
remote_file "#{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}" do
16-
source [node['mysql_connector']['j']['url'], node['mysql_connector']['j']['archive_url']]
16+
source node['mysql_connector']['j']['url']
1717
checksum node['mysql_connector']['j']['checksum']
1818
mode 00644
19+
ignore_failure true
1920
action :create
2021
end
2122

23+
# BEGIN: This is workaround for remote_file not supporting 404's
24+
# This is after various attempts at begin/rescue and requires ignore_failure above.
25+
remote_file "#{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}-archive_url" do
26+
source node['mysql_connector']['j']['archive_url']
27+
checksum node['mysql_connector']['j']['checksum']
28+
mode 00644
29+
not_if "test -s #{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}"
30+
action :create
31+
end
32+
33+
execute 'mysql_connector_j_mv_archive_url' do
34+
cwd Chef::Config[:file_cache_path]
35+
command "mv #{node['mysql_connector']['j']['tar_file']}-archive_url #{node['mysql_connector']['j']['tar_file']}"
36+
not_if "test -s #{Chef::Config[:file_cache_path]}/#{node['mysql_connector']['j']['tar_file']}"
37+
action :run
38+
end
39+
# END: This is workaround for remote_file not supporting 404's
40+
2241
execute "mysql-connector-java-#{new_resource.path}" do
2342
cwd Chef::Config[:file_cache_path]
2443
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']}"

0 commit comments

Comments
 (0)