Skip to content

Commit

Permalink
Merge pull request sous-chefs#306 from hw-cookbooks/update/ca-certifi…
Browse files Browse the repository at this point in the history
…cates

Update ca certificates - Update version comparison to configure setup_script
  • Loading branch information
agoddard committed Nov 26, 2015
2 parents 2cd6d50 8f3667e commit 2088fc6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 133,7 @@
default['postgresql']['server']['service_name'] = "postgresql"
default['postgresql']['setup_script'] = "postgresql-setup"

if node['postgresql']['version'] == '9.3'
if node['postgresql']['version'].to_f >= 9.3
default['postgresql']['setup_script'] = "/usr/pgsql-#{node['postgresql']['version']}/bin/postgresql#{node['postgresql']['version'].split('.').join}-setup"
end

Expand Down Expand Up @@ -177,7 177,7 @@
default['postgresql']['server']['service_name'] = "postgresql-#{node['postgresql']['version']}"
end

if node['postgresql']['version'] == '9.3'
if node['postgresql']['version'].to_f >= 9.3
default['postgresql']['setup_script'] = "/usr/pgsql-#{node['postgresql']['version']}/bin/postgresql#{node['postgresql']['version'].split('.').join}-setup"
end
else
Expand Down
6 changes: 6 additions & 0 deletions recipes/ca_certificates.rb
Original file line number Diff line number Diff line change
@@ -0,0 1,6 @@
# some older linux distributions have expired certificate bundles
# for pgdg repositories. Upgrading this package before trying to
# install postgresql is necessary.
package "ca-certificates" do
action :upgrade
end
2 changes: 2 additions & 0 deletions recipes/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 15,8 @@
# limitations under the License.
#

include_recipe "postgresql::ca_certificates"

if platform_family?('debian') && node['postgresql']['version'].to_f > 9.3
node.default['postgresql']['enable_pgdg_apt'] = true
end
Expand Down
3 changes: 3 additions & 0 deletions recipes/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 35,9 @@

if node['postgresql']['enable_pgdg_yum']
repo_rpm_url, repo_rpm_filename, repo_rpm_package = pgdgrepo_rpm_info
package "ca-certificates" do
action :nothing
end.run_action(:upgrade)
include_recipe "postgresql::yum_pgdg_postgresql"
resources("remote_file[#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}]").run_action(:create)
resources("package[#{repo_rpm_package}]").run_action(:install)
Expand Down
2 changes: 2 additions & 0 deletions recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 15,8 @@
# limitations under the License.
#

include_recipe "postgresql::ca_certificates"

::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword)

include_recipe "postgresql::client"
Expand Down

0 comments on commit 2088fc6

Please sign in to comment.