Skip to content

Commit 1d974be

Browse files
kbarberbmjen
authored andcommitted
(MODULES-2181) Fix variable scope for systemd-override
$manage_package_repo wasn't in scope for the template systemd-override.erb This was causing all RHEL7 systems with manage_package_repo on to fail on startup using systemctl, as the proper path to the original service file is set incorrectly. This patch adds the manage_package_repo to the top of the ::config class, and adds some basic tests in config_spec.rb to ensure we don't regress on this. Signed-off-by: Ken Barber <[email protected]>
1 parent 3e6a22d commit 1d974be

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

Diff for: CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2015-07-01 - Supported Release 4.4.1
2+
### Summary
3+
This release fixes RHEL 7 & Fedora with manage_package_repo switched on.
4+
5+
#### Bugfixes
6+
- Ensure manage_package_repo variable is in scope for systemd-override file for RHEL7
7+
18
## 2015-06-30 - Supported Release 4.4.0
29
### Summary
310
This release has several new features, bugfixes, and test improvements.

Diff for: manifests/server/config.pp

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
$user = $postgresql::server::user
1515
$group = $postgresql::server::group
1616
$version = $postgresql::server::_version
17+
$manage_package_repo = $postgresql::server::manage_package_repo
1718
$manage_pg_hba_conf = $postgresql::server::manage_pg_hba_conf
1819
$manage_pg_ident_conf = $postgresql::server::manage_pg_ident_conf
1920
$manage_recovery_conf = $postgresql::server::manage_recovery_conf

Diff for: spec/unit/classes/server/config_spec.rb

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
require 'spec_helper'
2+
3+
describe 'postgresql::server::config', :type => :class do
4+
let (:pre_condition) do
5+
"include postgresql::server"
6+
end
7+
8+
describe 'on RedHat 7' do
9+
let :facts do
10+
{
11+
:osfamily => 'RedHat',
12+
:operatingsystem => 'CentOS',
13+
:operatingsystemrelease => '7.0',
14+
:concat_basedir => tmpfilename('server'),
15+
:kernel => 'Linux',
16+
:id => 'root',
17+
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
18+
}
19+
end
20+
it 'should have the correct systemd-override file' do
21+
is_expected.to contain_file('systemd-override').with ({
22+
:ensure => 'present',
23+
:path => '/etc/systemd/system/postgresql.service',
24+
:owner => 'root',
25+
:group => 'root',
26+
})
27+
is_expected.to contain_file('systemd-override') \
28+
.with_content(/postgresql.service/)
29+
end
30+
31+
describe 'with manage_package_repo => true and a version' do
32+
let (:pre_condition) do
33+
<<-EOS
34+
class { 'postgresql::globals':
35+
manage_package_repo => true,
36+
version => '9.4',
37+
}->
38+
class { 'postgresql::server': }
39+
EOS
40+
end
41+
42+
it 'should have the correct systemd-override file' do
43+
is_expected.to contain_file('systemd-override').with ({
44+
:ensure => 'present',
45+
:path => '/etc/systemd/system/postgresql-9.4.service',
46+
:owner => 'root',
47+
:group => 'root',
48+
})
49+
is_expected.to contain_file('systemd-override') \
50+
.with_content(/postgresql-9.4.service/)
51+
end
52+
end
53+
end
54+
end
55+

0 commit comments

Comments
 (0)