Permalink
Browse files

=== MERGE from Feb 22 head of opscode-cookbooks/postgresql.

(Merged my Jan 6 COOK-2163 and Feb 11-21 COOK-2390 commits)
  • Loading branch information...
2 parents 38a1704 + 6058770 commit b9e4e15ac43daa9d0c07439a9881de720e34637d @davidc-donorschoose davidc-donorschoose committed Feb 23, 2013
View
1 .gitignore
@@ -2,3 +2,4 @@
.cache
.kitchen
bin
+Gemfile.lock
View
5 CHANGELOG.md
@@ -1,3 +1,8 @@
+## v2.2.2:
+
+* [COOK-2232] -Provide PGDG yum repo to install postgresql 9.x on
+ redhat-derived distributions
+
## v2.2.0:
* [COOK-2230] - Careful about Debian minor version numbers
View
2 Gemfile
@@ -1,3 +1,3 @@
source :rubygems
-gem 'test-kitchen', '<= 1.0'
+gem 'test-kitchen', '< 1.0'
View
4 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.2.0"
+version "2.2.2"
recipe "postgresql", "Includes postgresql::client"
recipe "postgresql::ruby", "Installs pg gem for Ruby bindings"
recipe "postgresql::client", "Installs postgresql client package(s)"
@@ -20,4 +20,6 @@
supports el, ">= 6.0"
end
+depends "apt"
+depends "build-essential"
depends "openssl"
View
4 recipes/yum_pgdg_postgresql.rb
@@ -47,13 +47,13 @@
# Download the PGDG repository RPM as a local file
remote_file "#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}" do
- source "#{repo_rpm_url}"
+ source repo_rpm_url
mode "0644"
end
# Install the PGDG repository RPM from the local file
# E.g., /etc/yum.repos.d/pgdg-91-centos.repo
-package "#{repo_rpm_package}" do
+package repo_rpm_package do
provider Chef::Provider::Package::Rpm
source "#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}"
action :install
View
148 templates/default/pg_hba.conf.erb
@@ -4,114 +4,7 @@
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
-# documentation for a complete description of this file. A short
-# synopsis follows.
-#
-# This file controls: which hosts are allowed to connect, how clients
-# are authenticated, which PostgreSQL user names they can use, which
-# databases they can access. Records take one of these forms:
-#
-# local DATABASE USER METHOD [OPTIONS]
-<% if node['postgresql']['version'].to_f < 9.1 -%>
-# host DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]
-# hostssl DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]
-# hostnossl DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]
-<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
-# host DATABASE USER ADDRESS METHOD [OPTIONS]
-# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
-# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
-<% end -%>
-#
-# (The uppercase items must be replaced by actual values.)
-#
-# The first field is the connection type: "local" is a Unix-domain
-# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
-# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
-# plain TCP/IP socket.
-#
-<% if node['postgresql']['version'].to_f < 9.0 -%>
-# DATABASE can be "all", "sameuser", "samerole", a
-<% elsif node['postgresql']['version'].to_f >= 9.0 -%>
-# DATABASE can be "all", "sameuser", "samerole", "replication", a
-<% end -%>
-<% if node['postgresql']['version'].to_f < 9.1 -%>
-# database name, or a comma-separated list thereof.
-<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
-# database name, or a comma-separated list thereof. The "all"
-# keyword does not match "replication". Access to replication
-# must be enabled in a separate record (see example below).
-<% end -%>
-#
-# USER can be "all", a user name, a group name prefixed with "+", or a
-# comma-separated list thereof. In both the DATABASE and USER fields
-# you can also write a file name prefixed with "@" to include names
-# from a separate file.
-#
-<% if node['postgresql']['version'].to_f < 9.1 -%>
-# CIDR-ADDRESS specifies the set of hosts the record matches.
-# It is made up of an IP address and a CIDR mask that is
-<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
-# ADDRESS specifies the set of hosts the record matches. It can be a
-# host name, or it is made up of an IP address and a CIDR mask that is
-<% end -%>
-# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
-<% if node['postgresql']['version'].to_f < 9.1 -%>
-# specifies the number of significant bits in the mask.
-<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
-# specifies the number of significant bits in the mask. A host name
-# that starts with a dot (.) matches a suffix of the actual host name.
-<% end -%>
-# Alternatively, you can write an IP address and netmask in separate
-<% if node['postgresql']['version'].to_f < 9.0 -%>
-# columns to specify the set of hosts.
-<% elsif node['postgresql']['version'].to_f >= 9.0 -%>
-# columns to specify the set of hosts. Instead of a CIDR-address, you
-# can write "samehost" to match any of the server's own IP addresses,
-# or "samenet" to match any address in any subnet that the server is
-# directly connected to.
-<% end -%>
-#
-# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
-<% if node['postgresql']['version'].to_f < 9.0 -%>
-# "krb5", "ident", "pam", "ldap" or "cert". Note that
-<% elsif node['postgresql']['version'].to_f < 9.1 -%>
-# "krb5", "ident", "pam", "ldap", "radius" or "cert". Note that
-<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
-# "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
-<% end -%>
-# "password" sends passwords in clear text; "md5" is preferred since
-# it sends encrypted passwords.
-#
-# OPTIONS are a set of options for the authentication in the format
-# NAME=VALUE. The available options depend on the different
-# authentication methods -- refer to the "Client Authentication"
-# section in the documentation for a list of which options are
-# available for which authentication methods.
-#
-# Database and user names containing spaces, commas, quotes and other
-# special characters must be quoted. Quoting one of the keywords
-<% if node['postgresql']['version'].to_f < 9.0 -%>
-# "all", "sameuser" or "samerole" makes the name lose
-<% elsif node['postgresql']['version'].to_f >= 9.0 -%>
-# "all", "sameuser", "samerole" or "replication" makes the name lose
-<% end -%>
-# its special character, and just match a database or username with
-# that name.
-#
-# This file is read on server startup and when the postmaster receives
-# a SIGHUP signal. If you edit the file on a running system, you have
-# to SIGHUP the postmaster for the changes to take effect. You can
-# use "pg_ctl reload" to do that.
-
-# Put your actual configuration here
-# ----------------------------------
-#
-# If you want to allow non-local connections, you need to add more
-# "host" records. In that case you will also need to make PostgreSQL
-# listen on a non-local interface via the listen_addresses
-# configuration parameter, or via the -i or -h command line switches.
-
-
+# documentation for a complete description of this file.
<% if node['postgresql']['version'].to_f < 9.1 -%>
# TYPE DATABASE USER CIDR-ADDRESS METHOD
@@ -125,45 +18,6 @@ local all all ident
<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
local all all peer
<% end -%>
-# IPv4 local connections:
-#host all all 127.0.0.1/32 ident
-# IPv6 local connections:
-#host all all ::1/128 ident
-<% if node['postgresql']['version'].to_f >= 9.1 -%>
-# Allow replication connections from localhost, by a user with the
-# replication privilege.
-#local replication postgres peer
-#host replication postgres 127.0.0.1/32 ident
-#host replication postgres ::1/128 ident
-<% end -%>
-
-###########
-# The preceeding rule for local login by Unix-domain socket connections
-# was in the pg_hba.conf released by the Postgres Development Group.
-# It was left here as a hard-coded authentication configuration since
-# it is needed by the chef postgresql cookbook recipes.
-#
-# Effectively, it lets postgresql rely on OS account authentication.
-# It allows an OS user to login as the same-named postgresql database
-# user without a password challenge via the Unix-domain socket, but only
-# for same host/no network connections.
-#
-# Specifically, this allows the 'postgres' user to run the psql command
-# on the local host with no -h hostname, with no password. This allows
-# chef recipes to build resources such as the following:
-#
-# bash "some-database-administration-task" do
-# user 'postgres'
-# code <<-EOH
-# echo "-- put sql statement here" | psql
-# EOH
-# action :run
-# end
-#
-# Note that the chef cookbook cannot use the md5 method (password),
-# since chef only has the encrypted password through a node attribute
-# and the plain text password cannot be derived.
-###########
###########
# Other authentication configurations taken from chef node defaults:
View
2 test/kitchen/Kitchenfile
@@ -4,5 +4,7 @@ cookbook "postgresql" do
configuration "server"
configuration "contrib"
configuration "ppa_pitti_postgresql"
+ configuration "yum_pgdg_postgresql"
exclude :platform => 'centos', :configuration => 'ppa_pitti_postgresql'
+ exclude :platform => 'ubuntu', :configuration => 'yum_pgdg_postgresql'
end
View
24 test/kitchen/cookbooks/postgresql_test/recipes/yum_pgdg_postgresql.rb
@@ -0,0 +1,24 @@
+#
+# Cookbook Name:: postgresql_test
+# Recipe:: yum_pgdg_postgresql
+#
+# Copyright 2013, 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.
+#
+
+node.set['postgresql']['enable_pgdg_yum'] = true
+node.set['postgresql']['version'] = '9.2'
+node.set['postgresql']['client']['packages'] = %w{postgresql92}
+
+include_recipe "postgresql::default"

0 comments on commit b9e4e15

Please sign in to comment.