Skip to content

Commit 7b282bd

Browse files
author
Michael Watters
committed
(MODULES-9219) - puppetlabs-postgresql : catalog compilation fails when the service command is not installed
The service command is deprecated and is not installed by default on modern Redhat releases. Updated class parameters to define the service status and service reload commands based on what OS is installed on the node.
1 parent a21dac9 commit 7b282bd

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

manifests/params.pp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,33 @@
7878
}
7979
$confdir = pick($confdir, $datadir)
8080
}
81+
82+
case $::operatingsystem {
83+
'Amazon': {
84+
$service_reload = "service ${service_name} reload"
85+
$service_status = "service ${service_name} status"
86+
}
87+
88+
# RHEL 5 uses SysV init, RHEL 6 uses upstart. RHEL 7 and 8 both use systemd.
89+
'RedHat', 'CentOS', 'Scientific', 'OracleLinux': {
90+
if $::operatingsystemrelease =~ /^[78].*/ {
91+
$service_reload = "systemctl reload ${service_name}"
92+
$service_status = "systemctl status ${service_name}"
93+
} else {
94+
$service_reload = "service ${service_name} reload"
95+
$service_status = "service ${service_name} status"
96+
}
97+
}
98+
99+
# Default will catch Fedora which uses systemd
100+
default: {
101+
$service_reload = "systemctl reload ${service_name}"
102+
$service_status = "systemctl status ${service_name}"
103+
}
104+
}
105+
81106
$psql_path = pick($psql_path, "${bindir}/psql")
82107

83-
$service_status = $service_status
84-
$service_reload = "service ${service_name} reload"
85108
$perl_package_name = pick($perl_package_name, 'perl-DBD-Pg')
86109
$python_package_name = pick($python_package_name, 'python-psycopg2')
87110

0 commit comments

Comments
 (0)