From 29a597ab05522a0aa1f38c5f1f49f3fe05544866 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 3 Sep 2014 16:17:19 -0400 Subject: [PATCH] Improve port changing support. This makes Debian 6 work, and hopefully Ubuntu 10.04 too. --- manifests/server/config.pp | 2 +- manifests/server/config_entry.pp | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/manifests/server/config.pp b/manifests/server/config.pp index 5e0e619..2845cab 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -114,7 +114,7 @@ class postgresql::server::config { concat { $pg_ident_conf_path: owner => $user, group => $group, - force => true, # do not crash if there is no pg_ident_rules + force => true, # do not crash if there is no pg_ident_rules mode => '0640', warn => true, notify => Class['postgresql::server::reload'], diff --git a/manifests/server/config_entry.pp b/manifests/server/config_entry.pp index 9054888..a94caef 100644 --- a/manifests/server/config_entry.pp +++ b/manifests/server/config_entry.pp @@ -30,9 +30,23 @@ define postgresql::server::config_entry ( } } - # We have to handle ports in a weird and special way. On Redhat we either - # have to create a systemd override for the port or update the sysconfig - # file. + # We have to handle ports in a weird and special way. On early Debian and + # Ubuntu we have to ensure we stop the service completely. On Redhat we + # either have to create a systemd override for the port or update the + # sysconfig file. + if $::operatingsystem == 'Debian' or $::operatingsystem == 'Ubuntu' { + if $::operatingsystemrelease =~ /^6/ or $::operatingsystemrelease =~ /^10\.04/ { + if $name == 'port' { + exec { 'postgresql_stop': + command => "service ${::postgresql::server::service_name} stop", + onlyif => "service ${::postgresql::server::service_name} status", + unless => "grep 'port = ${value}' ${::postgresql::server::postgresql_conf_path}", + path => '/usr/sbin:/sbin:/bin:/usr/bin:/usr/local/bin', + before => Postgresql_conf[$name], + } + } + } + } if $::osfamily == 'RedHat' { if $::operatingsystemrelease =~ /^7/ or $::operatingsystem == 'Fedora' { if $name == 'port' {