Merge pull request #131 from kbarber/ticket/master/130-unsupported_include_directive_postgres_81

Ticket/master/130 unsupported include directive postgres 81
This commit is contained in:
Chris Price 2013-02-21 13:28:48 -08:00
commit ca41523630
7 changed files with 59 additions and 19 deletions

View file

@ -120,19 +120,25 @@ class postgresql::config::beforeservice(
}
# Here we are adding an 'include' line so that users have the option of
# managing their own settings in a second conf file.
file_line { 'postgresql.conf#include':
path => $postgresql_conf_path,
line => "include 'postgresql_puppet_extras.conf'",
notify => Service['postgresqld'],
# managing their own settings in a second conf file. This only works for
# postgresql 8.2 and higher.
if(versioncmp($postgresql::params::version, '8.2') >= 0) {
# Since we're adding an "include" for this extras config file, we need
# to make sure it exists.
exec { "create_postgresql_conf_path":
command => "touch `dirname ${postgresql_conf_path}`/postgresql_puppet_extras.conf",
path => '/usr/bin:/bin',
unless => "[ -f `dirname ${postgresql_conf_path}`/postgresql_puppet_extras.conf ]"
}
file_line { 'postgresql.conf#include':
path => $postgresql_conf_path,
line => "include 'postgresql_puppet_extras.conf'",
require => Exec["create_postgresql_conf_path"],
notify => Service['postgresqld'],
}
}
# Since we're adding an "include" for this extras config file, we need
# to make sure it exists.
exec { "touch `dirname ${postgresql_conf_path}`/postgresql_puppet_extras.conf" :
path => '/usr/bin:/bin',
unless => "[ -f `dirname ${postgresql_conf_path}`/postgresql_puppet_extras.conf ]"
}
# TODO: is this a reasonable place for this firewall stuff?
# TODO: figure out a way to make this not platform-specific; debian and ubuntu have

View file

@ -41,6 +41,7 @@ shared_examples :non_default_postgres do
it 'with locale and charset, the postgres database should reflect that locale' do
pending('no support for initdb with lucid', :if => vm == :lucid)
pending('no support for locale parameter with centos 5', :if => vm == :centos5)
manifest = <<-EOS
# Set global locale and charset option, and try installing postgres

View file

@ -51,6 +51,7 @@ shared_examples :system_default_postgres do
end
it 'should take a locale parameter' do
pending('no support for locale parameter with centos 5', :if => vm == :centos5)
manifest = <<-EOS
include postgresql::server
postgresql::db { 'test1':
@ -213,6 +214,8 @@ shared_examples :system_default_postgres do
describe 'postgresql.conf include' do
it "should support an 'include' directive at the end of postgresql.conf" do
pending('no support for include directive with centos 5', :if => vm == :centos5)
test_class = 'class {"postgresql_tests::system_default::test_pgconf_include": }'
# Run once to check for crashes

View file

@ -0,0 +1,12 @@
require File.expand_path(File.join(__FILE__, '../../../../support/vagrant_common'))
Vagrant::Config.run do |config|
config.vm.define :centos5 do |vm_config|
vm_config.vm.box = "centos-58-x64"
vm_config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-58-x64.box"
end
apply_common_vagrant_config(config)
end

View file

@ -0,0 +1,7 @@
require 'support/shared_examples/non_default_postgres'
describe "CentOS 5, 64-bit: non-default postgres" do
let(:vagrant_dir) { File.dirname(__FILE__) }
let(:vm) { :centos5 }
it_behaves_like :non_default_postgres
end

View file

@ -0,0 +1,8 @@
require 'support/shared_examples/system_default_postgres'
describe "CentOS 5, 64-bit: default system postgres" do
let(:vagrant_dir) { File.dirname(__FILE__) }
let(:vm) { :centos5 }
let(:service_name) { 'postgresql' }
it_behaves_like :system_default_postgres
end

View file

@ -20,15 +20,18 @@ class postgresql_tests::system_default::test_tablespace {
include postgresql::server
file { '/tmp':
ensure => 'directory',
}
file { '/tmp/pg_tablespaces':
ensure => 'directory',
owner => 'postgres',
group => 'postgres',
mode => '0700',
require => File['/tmp'],
ensure => 'directory',
owner => 'postgres',
group => 'postgres',
mode => '0700',
}~>
# This works around rubies that lack Selinux support, I'm looking at you RHEL5
exec { "chcon system_u:object_r:postgresql_db_t /tmp/pg_tablespaces":
refreshonly => true,
path => "/bin:/usr/bin",
onlyif => "which chcon",
before => File["/tmp/pg_tablespaces/space1", "/tmp/pg_tablespaces/space2"]
}
postgresql::tablespace{ 'tablespace1':