Skip to content

Commit

Permalink
Fixing the versioning of the class.
Browse files Browse the repository at this point in the history
versioning wasn't applied to the client or the package
In addition there was a hardcoded version in one of the templates.
  • Loading branch information
Ramon van Alteren committed Mar 20, 2012
1 parent df30f1b commit f969682
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions manifests/client.pp
@@ -1,5 +1,5 @@
class postgresql::client {
package { "postgresql-client":
class postgresql::client($version) {
package { "postgresql-client-${version}":
ensure => present,
}
}
18 changes: 13 additions & 5 deletions manifests/server.pp
Expand Up @@ -2,14 +2,22 @@
$listen_addresses='localhost',
$max_connections=100,
$shared_buffers='24MB') {
include postgresql::client
class { 'postgresql::client':
version => $version,
}

Class['postgresql::server'] -> Class['postgresql::client']

$service_name = $operatingsystem ? {
"Ubuntu" => "postgresql-${version}",
default => "postgresql",
}

package { postgresql:
$pkgname = $operatingsystem ? {
default => "postgresql-${version}",
}

package { "postgresql-${version}":
ensure => present,
}

Expand All @@ -22,21 +30,21 @@
path => "/etc/postgresql/${version}/main/pg_hba.conf",
source => "puppet:///modules/postgresql/pg_hba.conf",
mode => 640,
require => Package[postgresql],
require => Package[$pkgname],
}

file { "postgresql.conf":
path => "/etc/postgresql/${version}/main/postgresql.conf",
content => template("postgresql/postgresql.conf.erb"),
require => Package[postgresql],
require => Package[$pkgname],
}

service { $service_name:
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
subscribe => [Package["postgresql"],
subscribe => [Package[$pkgname],
File["pg_hba.conf"],
File["postgresql.conf"]],
}
Expand Down
8 changes: 4 additions & 4 deletions templates/postgresql.conf.erb
Expand Up @@ -38,15 +38,15 @@
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/8.4/main' # use data in another directory
data_directory = '/var/lib/postgresql/<%= version %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/8.4/main/pg_hba.conf' # host-based authentication file
hba_file = '/etc/postgresql/<%= version %>/main/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/8.4/main/pg_ident.conf' # ident configuration file
ident_file = '/etc/postgresql/<%= version %>/main/pg_ident.conf' # ident configuration file
# (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/8.4-main.pid' # write an extra PID file
external_pid_file = '/var/run/postgresql/<%= version %>-main.pid' # write an extra PID file
# (change requires restart)


Expand Down

0 comments on commit f969682

Please sign in to comment.