diff --git a/README.md b/README.md index 2e8693a..130f931 100644 --- a/README.md +++ b/README.md @@ -840,6 +840,7 @@ Contributors * Adrien Thebo * Albert Koch * Andreas Ntaflos + * Bret Comnes * Brett Porter * Chris Price * dharwood diff --git a/manifests/globals.pp b/manifests/globals.pp index 8c8ed7e..72329da 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -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', diff --git a/manifests/params.pp b/manifests/params.pp index 67f8b06..b7b9859 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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) } diff --git a/spec/unit/classes/server/initdb_spec.rb b/spec/unit/classes/server/initdb_spec.rb new file mode 100644 index 0000000..2dbccb0 --- /dev/null +++ b/spec/unit/classes/server/initdb_spec.rb @@ -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 \ No newline at end of file