Skip to content
Browse files

=== MERGE from release v2.2.0 of opscode-cookbooks/postgresql.

(Merged my COOK-2230, COOK-2231 and COOK-2233 changes from Jan 15)
  • Loading branch information...
2 parents 5269fa1 + 355a7a2 commit 49c094d9ff914cb1c55ce490b87957196b17e3d6 @davidc-donorschoose davidc-donorschoose committed
View
10 CHANGELOG.md
@@ -1,3 +1,13 @@
+## v2.2.0:
+
+* [COOK-2230] - Careful about Debian minor version numbers
+* [COOK-2231] - Fix support for postgresql 9.x in server_redhat recipe
+* [COOK-2238] - Postgresql recipe error in password check
+* [COOK-2176] - PostgreSQL cookbook in Solo mode can cause
+ "NoMethodError: undefined method `[]' for nil:NilClass"
+* [COOK-2233] - Provide postgresql::contrib recipe to install useful
+ server administration tools
+
## v2.1.0:
* [COOK-1872] - Allow latest PostgreSQL deb packages to be installed
View
2 Gemfile
@@ -1,3 +1,3 @@
source :rubygems
-gem 'test-kitchen'
+gem 'test-kitchen', '<= 1.0'
View
12 README.md
@@ -46,6 +46,8 @@ The following attributes are set based on the platform, see the
that should be installed on "client" systems.
* `node['postgresql']['server']['packages']` - An array of package names
that should be installed on "server" systems.
+* `node['postgresql']['contrib']['packages']` - An array of package names
+ that could be installed on "server" systems for useful sysadmin tools.
* `node['postgresql']['enable_pitti_ppa']` - Whether to enable the PPA
by Martin Pitti, which contains newer versions of PostgreSQL. See
@@ -174,6 +176,16 @@ database, and manages the postgresql service. You should include the
`postgresql::server` recipe, which will include this on RHEL/Fedora
platforms.
+contrib
+-------
+
+Installs the packages defined in the
+`node['postgresql']['contrib']['packages']` attribute.
+This is the contrib directory of the PostgreSQL distribution, which
+includes porting tools, analysis utilities, and plug-in features that
+database engineers often require. Some (like pgbench) are executable.
+Others (like pg_buffercache) should be installed into the database.
+
ppa\_pitti\_postgresql
----------------------
View
16 attributes/default.rb
@@ -21,9 +21,9 @@
when "debian"
case
- when node['platform_version'].to_f <= 5.0
+ when node['platform_version'].to_f < 6.0 # All 5.X
default['postgresql']['version'] = "8.3"
- when node['platform_version'].to_f == 6.0
+ when node['platform_version'].to_f < 7.0 # All 6.X
default['postgresql']['version'] = "8.4"
else
default['postgresql']['version'] = "9.1"
@@ -31,7 +31,7 @@
default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
case
- when node['platform_version'].to_f <= 5.0
+ when node['platform_version'].to_f < 6.0 # All 5.X
default['postgresql']['server']['service_name'] = "postgresql-#{node['postgresql']['version']}"
else
default['postgresql']['server']['service_name'] = "postgresql"
@@ -39,6 +39,7 @@
default['postgresql']['client']['packages'] = %w{postgresql-client libpq-dev}
default['postgresql']['server']['packages'] = %w{postgresql}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
when "ubuntu"
@@ -61,6 +62,7 @@
default['postgresql']['client']['packages'] = %w{postgresql-client libpq-dev}
default['postgresql']['server']['packages'] = %w{postgresql}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
when "fedora"
@@ -73,6 +75,7 @@
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"
when "amazon"
@@ -81,6 +84,7 @@
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"
when "redhat", "centos", "scientific", "oracle"
@@ -91,9 +95,11 @@
if node['platform_version'].to_f >= 6.0
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
else
default['postgresql']['client']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-devel"]
default['postgresql']['server']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-server"]
+ default['postgresql']['contrib']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-contrib"]
end
default['postgresql']['server']['service_name'] = "postgresql"
@@ -108,6 +114,7 @@
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"
else
@@ -115,6 +122,7 @@
default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
default['postgresql']['client']['packages'] = ["postgresql"]
default['postgresql']['server']['packages'] = ["postgresql"]
+ default['postgresql']['contrib']['packages'] = ["postgresql"]
default['postgresql']['server']['service_name'] = "postgresql"
end
@@ -171,4 +179,6 @@
{:type => 'host', :db => 'all', :user => 'all', :addr => '::1/128', :method => 'md5'}
]
+default['postgresql']['password'] = Hash.new
+
default['postgresql']['enable_pitti_ppa'] = false
View
2 files/default/tests/minitest/ppa_pitti_postgresql_test.rb
@@ -21,7 +21,7 @@
it 'creates the Pitti PPA sources.list' do
skip unless %w{debian}.include?(node['platform_family'])
- file("/etc/apt/sources.list.d/pitti-postgresql-ppa-source.list").must_exist
+ file("/etc/apt/sources.list.d/pitti-postgresql-ppa.list").must_exist
end
it 'installs postgresql-client-9.2' do
View
2 metadata.rb
@@ -4,7 +4,7 @@
license "Apache 2.0"
description "Installs and configures postgresql for clients or servers"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "2.1.0"
+version "2.2.0"
recipe "postgresql", "Includes postgresql::client"
recipe "postgresql::ruby", "Installs pg gem for Ruby bindings"
recipe "postgresql::client", "Installs postgresql client package(s)"
View
24 recipes/contrib.rb
@@ -0,0 +1,24 @@
+#
+# Cookbook Name:: postgresql
+# Recipe:: contrib
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "postgresql::server"
+
+node['postgresql']['contrib']['packages'].each do |pg_pack|
+
+ package pg_pack
+
+end
View
2 recipes/server.rb
@@ -76,6 +76,6 @@
code <<-EOH
echo "ALTER ROLE postgres ENCRYPTED PASSWORD '#{node['postgresql']['password']['postgres']}';" | psql
EOH
- not_if "echo '\connect' | PGPASSWORD=#{node['postgresql']['password']['postgres']} psql --username=postgres --no-password -h localhost"
+ not_if "echo '\\connect' | PGPASSWORD=#{node['postgresql']['password']['postgres']} psql --username=postgres --no-password -h localhost"
action :run
end
View
18 recipes/server_redhat.rb
@@ -44,22 +44,8 @@
end
-case node['platform_family']
-when "rhel"
- case
- when node['platform_version'].to_f >= 6.0
- package "postgresql-server"
- else
- package "postgresql#{node['postgresql']['version'].split('.').join}-server"
- end
-when "fedora", "suse"
- package "postgresql-server"
-end
-
-if node['postgresql']['version'].to_f < 9.0
- execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
- not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
- end
+execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
+ not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
end
service "postgresql" do
View
2 test/kitchen/Kitchenfile
@@ -2,5 +2,7 @@ cookbook "postgresql" do
configuration "default"
configuration "ruby"
configuration "server"
+ configuration "contrib"
configuration "ppa_pitti_postgresql"
+ exclude :platform => 'centos', :configuration => 'ppa_pitti_postgresql'
end
View
1 test/kitchen/cookbooks/postgresql_test/attributes/default.rb
@@ -0,0 +1 @@
+node.set['postgresql']['password']['postgres'] = "iloverandompasswordsbutthiswilldo"
View
20 test/kitchen/cookbooks/postgresql_test/recipes/contrib.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: postgresql_test
+# Recipe:: contrib
+#
+# Copyright 2012, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "postgresql::contrib"
View
2 test/kitchen/cookbooks/postgresql_test/recipes/server.rb
@@ -18,7 +18,5 @@
# limitations under the License.
#
-node.set['postgresql']['password']['postgres'] = "iloverandompasswordsbutthiswilldo"
-
include_recipe "postgresql::ruby"
include_recipe "postgresql::server"

0 comments on commit 49c094d

Please sign in to comment.
Something went wrong with that request. Please try again.