Fix debian 7 regexp, rename to default_version and some cleanup

Signed-off-by: Ken Barber <ken@bob.sh>
This commit is contained in:
Ken Barber 2013-09-03 11:46:07 -07:00
parent 7d84b6ac0e
commit a0a2a00a49
4 changed files with 39 additions and 33 deletions

View file

@ -41,7 +41,7 @@ class postgresql::globals (
) {
# We are determining this here, because it is needed by the package repo
# class.
$postgres_default_version = $::osfamily ? {
$default_version = $::osfamily ? {
/^(RedHat|Linux)/ => $::operatingsystemrelease ? {
/^6\./ => '8.4',
/^5\./ => '8.1',
@ -50,7 +50,7 @@ class postgresql::globals (
'Debian' => $::operatingsystem ? {
'Debian' => $::operatingsystemrelease ? {
/^6\./ => '8.4',
/^(wheezy|7\.)$/ => '9.1',
/^(wheezy|7\.)/ => '9.1',
default => undef,
},
'Ubuntu' => $::operatingsystemrelease ? {
@ -62,7 +62,7 @@ class postgresql::globals (
},
default => undef,
}
$globals_version = pick($version, $postgres_default_version, 'unknown')
$globals_version = pick($version, $default_version, 'unknown')
if($globals_version == 'unknown') {
fail("No preferred version defined or automatically detected.")
}

View file

@ -13,33 +13,33 @@ class postgresql::params inherits postgresql::globals {
# Amazon Linux's OS Family is 'Linux', operating system 'Amazon'.
case $::osfamily {
'RedHat', 'Linux': {
$needs_initdb = pick($needs_initdb, true)
$firewall_supported = pick($firewall_supported, true)
$needs_initdb = pick($needs_initdb, true)
$firewall_supported = pick($firewall_supported, true)
if $version == $postgres_default_version {
$client_package_name = pick($client_package_name, 'postgresql')
$server_package_name = pick($server_package_name, 'postgresql-server')
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')
$devel_package_name = pick($devel_package_name, 'postgresql-devel')
$java_package_name = pick($java_package_name, 'postgresql-jdbc')
$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')
$confdir = pick($confdir, $datadir)
if $version == $default_version {
$client_package_name = pick($client_package_name, 'postgresql')
$server_package_name = pick($server_package_name, 'postgresql-server')
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')
$devel_package_name = pick($devel_package_name, 'postgresql-devel')
$java_package_name = pick($java_package_name, 'postgresql-jdbc')
$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')
$confdir = pick($confdir, $datadir)
} else {
$version_parts = split($version, '[.]')
$package_version = "${version_parts[0]}${version_parts[1]}"
$client_package_name = pick($client_package_name, "postgresql${package_version}")
$server_package_name = pick($server_package_name, "postgresql${package_version}-server")
$contrib_package_name = pick($contrib_package_name,"postgresql${package_version}-contrib")
$devel_package_name = pick($devel_package_name, "postgresql${package_version}-devel")
$java_package_name = pick($java_package_name, "postgresql${package_version}-jdbc")
$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")
$confdir = pick($confdir, $datadir)
$version_parts = split($version, '[.]')
$package_version = "${version_parts[0]}${version_parts[1]}"
$client_package_name = pick($client_package_name, "postgresql${package_version}")
$server_package_name = pick($server_package_name, "postgresql${package_version}-server")
$contrib_package_name = pick($contrib_package_name,"postgresql${package_version}-contrib")
$devel_package_name = pick($devel_package_name, "postgresql${package_version}-devel")
$java_package_name = pick($java_package_name, "postgresql${package_version}-jdbc")
$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")
$confdir = pick($confdir, $datadir)
}
$service_status = $service_status

View file

@ -18,14 +18,14 @@ define postgresql::server::db (
if ! defined(Postgresql::Server::Role[$user]) {
postgresql::server::role { $user:
password_hash => $password,
password_hash => $password,
}
}
postgresql::server::database_grant { "GRANT ${user} - ${grant} - ${name}":
privilege => $grant,
db => $name,
role => $user,
privilege => $grant,
db => $name,
role => $user,
}
if($tablespace != undef and defined(Postgresql::Server::Tablespace[$tablespace])) {

View file

@ -3,8 +3,14 @@ class postgresql::server::install {
$package_ensure = $postgresql::server::package_ensure
$package_name = $postgresql::server::package_name
$_package_ensure = $package_ensure ? {
true => 'present',
false => 'purged',
default => $package_ensure,
}
package { 'postgresql-server':
ensure => $package_ensure,
ensure => $_package_ensure,
name => $package_name,
# This is searched for to create relationships with the package repos, be