summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Stanley <fungi@yuggoth.org>2017-12-11 18:19:20 +0000
committerJeremy Stanley <fungi@yuggoth.org>2017-12-11 21:28:25 +0000
commite2743a3529f04f7ee088f41dad75a4994a0be259 (patch)
treec8d71aa6a8d978ccc452ec1b5ec2350db61d63b4
parent9e2a5d4633075a3938d1aca4c1ecf980bf7c3975 (diff)
Register the worker daemon with systemd
When installing a custom initscript for a worker daemon, reload systemd so it will pick that up before attempting to start the service. Wrap it in a conditional check for Ubuntu 16.04 or later, since earlier releases used upstart as their init instead of systemd. Make sure the initscript template uses a distinct "provides" key for each instance of the service as well. This implementation is copied from the puppet-zuul module. Change-Id: I4f7db205ac4ae29953757220dc0b9ae026ebbc71
Notes
Notes (review): Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Code-Review+2: Matthew Treinish <mtreinish@kortar.org> Workflow+1: Matthew Treinish <mtreinish@kortar.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 11 Dec 2017 23:25:26 +0000 Reviewed-on: https://review.openstack.org/527204 Project: openstack-infra/puppet-subunit2sql Branch: refs/heads/master
-rw-r--r--manifests/worker.pp11
-rwxr-xr-xtemplates/jenkins-subunit-worker.init.erb2
2 files changed, 12 insertions, 1 deletions
diff --git a/manifests/worker.pp b/manifests/worker.pp
index c700daa..566964f 100644
--- a/manifests/worker.pp
+++ b/manifests/worker.pp
@@ -96,6 +96,17 @@ if ! defined(File['/var/log/subunit2sql']) {
96 ], 96 ],
97 } 97 }
98 98
99 if ($::operatingsystem == 'Ubuntu') and ($::operatingsystemrelease >= '16.04') {
100 # This is a hack to make sure that systemd is aware of the new service
101 # before we attempt to start it.
102 exec { "jenkins-subunit-worker${suffix}-systemd-daemon-reload":
103 command => '/bin/systemctl daemon-reload',
104 before => Service["jenkins-subunit-worker${suffix}"],
105 subscribe => File["/etc/init.d/jenkins-subunit-worker${suffix}"],
106 refreshonly => true,
107 }
108 }
109
99 service { "jenkins-subunit-worker${suffix}": 110 service { "jenkins-subunit-worker${suffix}":
100 enable => true, 111 enable => true,
101 hasrestart => true, 112 hasrestart => true,
diff --git a/templates/jenkins-subunit-worker.init.erb b/templates/jenkins-subunit-worker.init.erb
index 08e6551..f77376a 100755
--- a/templates/jenkins-subunit-worker.init.erb
+++ b/templates/jenkins-subunit-worker.init.erb
@@ -1,6 +1,6 @@
1#! /bin/sh 1#! /bin/sh
2### BEGIN INIT INFO 2### BEGIN INIT INFO
3# Provides: jenkins-subunit-worker 3# Provides: jenkins-subunit-worker<%= suffix %>
4# Required-Start: $remote_fs $syslog 4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog 5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5 6# Default-Start: 2 3 4 5