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
This commit is contained in:
		@@ -96,6 +96,17 @@ if ! defined(File['/var/log/subunit2sql']) {
 | 
			
		||||
    ],
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if ($::operatingsystem == 'Ubuntu') and ($::operatingsystemrelease >= '16.04') {
 | 
			
		||||
    # This is a hack to make sure that systemd is aware of the new service
 | 
			
		||||
    # before we attempt to start it.
 | 
			
		||||
    exec { "jenkins-subunit-worker${suffix}-systemd-daemon-reload":
 | 
			
		||||
      command     => '/bin/systemctl daemon-reload',
 | 
			
		||||
      before      => Service["jenkins-subunit-worker${suffix}"],
 | 
			
		||||
      subscribe   => File["/etc/init.d/jenkins-subunit-worker${suffix}"],
 | 
			
		||||
      refreshonly => true,
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  service { "jenkins-subunit-worker${suffix}":
 | 
			
		||||
    enable     => true,
 | 
			
		||||
    hasrestart => true,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
### BEGIN INIT INFO
 | 
			
		||||
# Provides:          jenkins-subunit-worker
 | 
			
		||||
# Provides:          jenkins-subunit-worker<%= suffix %>
 | 
			
		||||
# Required-Start:    $remote_fs $syslog
 | 
			
		||||
# Required-Stop:     $remote_fs $syslog
 | 
			
		||||
# Default-Start:     2 3 4 5
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user