From f929cadd9cd83718894eaa7f9817c807f6f83848 Mon Sep 17 00:00:00 2001 From: Ryan Armstrong Date: Wed, 29 Jul 2015 16:53:00 +0800 Subject: [PATCH] (MODULES-2211) Fixed systemd-override for RedHat systems with unmanaged Yum repos This change lets the params class compute the name of the correct systemd unit file via $service_name. --- manifests/server/config.pp | 3 ++- templates/systemd-override.erb | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/manifests/server/config.pp b/manifests/server/config.pp index d12c500..592cd6a 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -20,6 +20,7 @@ class postgresql::server::config { $manage_recovery_conf = $postgresql::server::manage_recovery_conf $datadir = $postgresql::server::datadir $logdir = $postgresql::server::logdir + $service_name = $postgresql::server::service_name if ($manage_pg_hba_conf == true) { # Prepare the main pg_hba file @@ -163,7 +164,7 @@ class postgresql::server::config { if $::operatingsystemrelease =~ /^7/ or $::operatingsystem == 'Fedora' { file { 'systemd-override': ensure => present, - path => "/etc/systemd/system/${postgresql::params::service_name}.service", + path => "/etc/systemd/system/${service_name}.service", owner => root, group => root, content => template('postgresql/systemd-override.erb'), diff --git a/templates/systemd-override.erb b/templates/systemd-override.erb index 3910058..6e49736 100644 --- a/templates/systemd-override.erb +++ b/templates/systemd-override.erb @@ -1,8 +1,4 @@ -<% if @manage_package_repo and (scope.function_versioncmp([@version.to_s, '9.1']) >= 0) -%> -.include /lib/systemd/system/postgresql-<%= @version %>.service -<% else -%> -.include /lib/systemd/system/postgresql.service -<% end -%> +.include /lib/systemd/system/<%= @service_name %>.service [Service] Environment=PGPORT=<%= @port %> Environment=PGDATA=<%= @datadir %>