Removed postgresql::version class and moved version info to init.pp.

This commit is contained in:
Etienne Pelletier 2012-11-29 11:43:57 -06:00 committed by Chris Price
parent db1a34e7ea
commit 33add5e10a
7 changed files with 67 additions and 72 deletions

View file

@ -13,13 +13,19 @@
# Sample Usage:
#
class postgresql::devel(
$package_name = undef,
$package_name = '',
$package_ensure = 'present'
) {
require postgresql
$package_name_real = $package_name ? { undef => $postgresql::packages::devel_package_name, default => $package_name }
if ! $package_name {
include postgresql::packages
$package_name_real = $postgresql::packages::devel_package_name
}
else {
$package_name_real = $package_name
}
package { 'postgresql_devel':
ensure => $package_ensure,

View file

@ -2,9 +2,13 @@
#
# This class installs postgresql client software.
#
# Parameters:
# [*client_package_name*] - The name of the postgresql client package.
# *Note* don't forget to make sure to add any necessary yum or apt
# repositories if specifying a custom version.
#
# Parameters:
# [*version*] - The postgresql version to install.
# [*package_name*] - The name of the postgresql client package.
# [*ensure*] - the ensure parameter passed to the postgresql client package resource
# Actions:
#
# Requires:
@ -13,17 +17,18 @@
#
class postgresql (
$version = $::postgres_default_version,
$package_name = undef,
$package_name = '',
$package_ensure = 'present'
) inherits postgresql::params {
if ! defined(Class['postgresql::version']) {
class { 'postgresql::version':
version => $version
}
if ! $package_name {
include postgresql::packages
$package_name_real = $postgresql::packages::client_package_name
}
else {
$package_name_real = $package_name
}
include postgresql::packages
$package_name_real = $package_name ? { undef => $postgresql::packages::client_package_name, default => $package_name }
package { 'postgresql_client':
ensure => $package_ensure,

View file

@ -17,18 +17,35 @@
# limitations under the License.
class postgresql::initdb(
$datadir = $postgresql::paths::datadir,
$datadir = '',
$encoding = 'UTF8',
$group = 'postgres',
$initdb_path = $postgresql::paths::initdb_path,
$initdb_path = '',
$options = '',
$user = 'postgres'
) inherits postgresql::params {
$initdb_command = "${initdb_path} --encoding '${encoding}' --pgdata '${datadir}'"
if ! $datadir {
include postgresql::paths
$datadir_real = $postgresql::paths::datadir
}
else {
$datadir_real = $datadir
}
if ! $initdb_path {
include postgresql::paths
$initdb_path_real = $postgresql::paths::initdb_path
}
else {
$initdb_path_real = $initdb_path
}
$initdb_command = "${initdb_path_real} --encoding '${encoding}' --pgdata '${datadir_real}'"
exec { $initdb_command:
creates => "${datadir}/PG_VERSION",
creates => "${datadir_real}/PG_VERSION",
user => $user,
group => $group
}

View file

@ -1,6 +1,7 @@
# Class: postgresql::params
# Class: postgresql::packages
#
# The postgresql configuration settings.
# The postgresql packages. Figures out the package names based on
# the version parameter passed to the postgresql class.
#
# Parameters:
#
@ -10,10 +11,10 @@
#
# Sample Usage:
#
class postgresql::packages {
include postgresql::version
class postgresql::packages {
include postgresql
$version = $postgresql::version::version
$version = $postgresql::version
case $::osfamily {
'RedHat': {

View file

@ -1,6 +1,7 @@
# Class: postgresql::params
# Class: postgresql::path
#
# The postgresql configuration settings.
# The postgresql paths. Figures out various paths based on
# the version parameter passed to the postgresql class.
#
# Parameters:
#
@ -11,9 +12,10 @@
# Sample Usage:
#
class postgresql::paths {
include postgresql::version
include postgresql
$version = $postgresql::version
$version = $postgresql::version::version
case $::osfamily {
'RedHat': {
if $version == $::postgres_default_version {
@ -33,7 +35,7 @@ class postgresql::paths {
'Debian': {
case $::operatingsystem {
'Debian': {
$service_name = 'postgresql'
$service_name = 'postgresql'
}
'Ubuntu': {

View file

@ -15,25 +15,23 @@
# Sample Usage:
#
class postgresql::server (
$version = $::postgres_default_version,
$package_name = undef,
$package_name = '',
$package_ensure = 'present',
$service_provider = $postgresql::params::service_provider,
$service_status = $postgresql::params::service_status,
$config_hash = {}
) inherits postgresql::params {
if ! defined(Class['postgresql::version']) {
class { 'postgresql::version':
version => $version
}
}
include postgresql::packages
require postgresql
include postgresql::paths
$package_name_real = $package_name ? { undef => $postgresql::packages::server_package_name, default => $package_name }
if ! $package_name {
include postgresql::packages
$package_name_real = $postgresql::packages::server_package_name
}
else {
$package_name_real = $package_name
}
package { 'postgresql-server':
ensure => $package_ensure,

View file

@ -1,34 +0,0 @@
# ==Class: postgresql::version
#
# Used by other classes in the postgresql module to
# determine which version of Postgresql to install/configure.
#
# Note: It must be declared before the postgresql or
# postgresql::server classes get included.
#
# === Parameters
#
# [*version*] the version number.
#
# === Examples
#
# class { 'postgresql::version':
# version => '9.0',
# }
#
# class { 'postgresql::server':
# config_hash => {
# 'ip_mask_deny_postgres_user' => '0.0.0.0/32',
# 'ip_mask_allow_all_users' => '0.0.0.0/0',
# 'listen_addresses' => '*',
# 'manage_redhat_firewall' => false,
# 'postgres_password' => 'changeme',
# },
# }
#
# === Authors
#
# Etienne Pelletier <epelletier@maestrodev.com>
#
class postgresql::version($version = $::postgres_default_version) {
}