Special case for $datadir on Amazon

Closes #252
This commit is contained in:
Bret Comnes 2013-10-02 12:38:20 -07:00
parent fc48c19894
commit 2718f14017
4 changed files with 38 additions and 2 deletions

View file

@ -840,6 +840,7 @@ Contributors
* Adrien Thebo
* Albert Koch
* Andreas Ntaflos
* Bret Comnes
* Brett Porter
* Chris Price
* dharwood

View file

@ -50,6 +50,7 @@ class postgresql::globals (
/^(18|19|20)$/ => '9.2',
default => undef,
},
'Amazon' => '9.2',
default => $::operatingsystemrelease ? {
/^6\./ => '8.4',
/^5\./ => '8.1',

View file

@ -29,7 +29,10 @@ class postgresql::params inherits postgresql::globals {
$plperl_package_name = pick($plperl_package_name, 'postgresql-plperl')
$service_name = pick($service_name, 'postgresql')
$bindir = pick($bindir, '/usr/bin')
$datadir = pick($datadir, '/var/lib/pgsql/data')
$datadir = $::operatingsystem ? {
'Amazon' => pick($datadir, '/var/lib/pgsql9/data'),
default => pick($datadir, '/var/lib/pgsql/data'),
}
$confdir = pick($confdir, $datadir)
} else {
$version_parts = split($version, '[.]')
@ -42,7 +45,10 @@ class postgresql::params inherits postgresql::globals {
$plperl_package_name = pick($plperl_package_name, "postgresql${package_version}-plperl")
$service_name = pick($service_name, "postgresql-${version}")
$bindir = pick($bindir, "/usr/pgsql-${version}/bin")
$datadir = pick($datadir, "/var/lib/pgsql/${version}/data")
$datadir = $::operatingsystem ? {
'Amazon' => pick($datadir, "/var/lib/pgsql9/${version}/data"),
default => pick($datadir, "/var/lib/pgsql/${version}/data"),
}
$confdir = pick($confdir, $datadir)
}

View file

@ -0,0 +1,28 @@
require 'spec_helper'
describe 'postgresql::server::initdb', :type => :class do
let (:pre_condition) do
"include postgresql::server"
end
describe 'on RedHat' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '6.0',
:concat_basedir => tmpfilename('server'),
}
end
it { should contain_file('/var/lib/pgsql/data').with_ensure('directory') }
end
describe 'on Amazon' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'Amazon',
:concat_basedir => tmpfilename('server'),
}
end
it { should contain_file('/var/lib/pgsql9/data').with_ensure('directory') }
end
end