Skip to content

Commit 8498326

Browse files
authored
Merge pull request #1233 from ekohl/fix-systemd-reload
Also perform systemd daemon-reload on Puppet 6.1+
2 parents 3c6e00e + 75cdb52 commit 8498326

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

manifests/server/config.pp

+20-21
Original file line numberDiff line numberDiff line change
@@ -216,42 +216,41 @@
216216
# RHEL 7 and 8 both support drop-in files for systemd units. The old include directive is deprecated and may be removed in future systemd releases.
217217
# Gentoo also supports drop-in files.
218218
if $facts['os']['family'] in ['RedHat', 'Gentoo'] and $facts['service_provider'] == 'systemd' {
219-
# Template uses:
220-
# - $facts['os']['name']
221-
# - $facts['os']['release']['major']
222-
# - $service_name
223-
# - $port
224-
# - $datadir
225-
# - @extra_systemd_config
226-
227-
if (versioncmp($facts['puppetversion'], '6.1.0') < 0) {
228-
exec { 'restart-systemd':
229-
command => 'systemctl daemon-reload',
230-
refreshonly => true,
231-
path => '/bin:/usr/bin:/usr/local/bin',
232-
before => Class['postgresql::server::service'],
233-
}
234-
$systemd_notify = [Exec['restart-systemd'], Class['postgresql::server::service']]
235-
}
236-
else {
237-
$systemd_notify = Class['postgresql::server::service']
219+
# While Puppet 6.1 and newer can do a daemon-reload if needed, systemd
220+
# doesn't appear to report that correctly in all cases.
221+
# One such case seems to be when an overriding unit file is removed from /etc
222+
# and the original one from /lib *should* be used again.
223+
#
224+
# This can be removed when Puppet < 6.1 support is dropped *and* the file
225+
# old-systemd-override is removed.
226+
exec { 'restart-systemd':
227+
command => 'systemctl daemon-reload',
228+
refreshonly => true,
229+
path => '/bin:/usr/bin:/usr/local/bin',
230+
before => Class['postgresql::server::service'],
238231
}
239232

240233
file {
241234
default:
242235
ensure => file,
243236
owner => root,
244237
group => root,
245-
notify => $systemd_notify,
238+
notify => [Exec['restart-systemd'], Class['postgresql::server::service']],
246239
before => Class['postgresql::server::reload'],
247-
248240
;
249241

250242
'systemd-conf-dir':
251243
ensure => directory,
252244
path => "/etc/systemd/system/${service_name}.service.d",
253245
;
254246

247+
# Template uses:
248+
# - $facts['os']['name']
249+
# - $facts['os']['release']['major']
250+
# - $service_name
251+
# - $port
252+
# - $datadir
253+
# - $extra_systemd_config
255254
'systemd-override':
256255
path => "/etc/systemd/system/${service_name}.service.d/${service_name}.conf",
257256
content => template('postgresql/systemd-override.erb'),

0 commit comments

Comments
 (0)