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 # Here we are adding an 'include' line so that users have the option of
# managing their own settings in a second conf file. # managing their own settings in a second conf file. This only works for
file_line { 'postgresql.conf#include': # postgresql 8.2 and higher.
path => $postgresql_conf_path, if(versioncmp($postgresql::params::version, '8.2') >= 0) {
line => "include 'postgresql_puppet_extras.conf'", # Since we're adding an "include" for this extras config file, we need
notify => Service['postgresqld'], # 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: is this a reasonable place for this firewall stuff?
# TODO: figure out a way to make this not platform-specific; debian and ubuntu have # 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 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 initdb with lucid', :if => vm == :lucid)
pending('no support for locale parameter with centos 5', :if => vm == :centos5)
manifest = <<-EOS manifest = <<-EOS
# Set global locale and charset option, and try installing postgres # Set global locale and charset option, and try installing postgres

View file

@ -51,6 +51,7 @@ shared_examples :system_default_postgres do
end end
it 'should take a locale parameter' do it 'should take a locale parameter' do
pending('no support for locale parameter with centos 5', :if => vm == :centos5)
manifest = <<-EOS manifest = <<-EOS
include postgresql::server include postgresql::server
postgresql::db { 'test1': postgresql::db { 'test1':
@ -213,6 +214,8 @@ shared_examples :system_default_postgres do
describe 'postgresql.conf include' do describe 'postgresql.conf include' do
it "should support an 'include' directive at the end of postgresql.conf" 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": }' test_class = 'class {"postgresql_tests::system_default::test_pgconf_include": }'
# Run once to check for crashes # 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 include postgresql::server
file { '/tmp':
ensure => 'directory',
}
file { '/tmp/pg_tablespaces': file { '/tmp/pg_tablespaces':
ensure => 'directory', ensure => 'directory',
owner => 'postgres', owner => 'postgres',
group => 'postgres', group => 'postgres',
mode => '0700', mode => '0700',
require => File['/tmp'], }~>
# 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': postgresql::tablespace{ 'tablespace1':