Package: puppet / 3.7.2-4+deb8u1

0004-debian-service-provider-use-service.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From: Gaudenz Steinlin <gaudenz@debian.org>
Subject: Use /usr/sbin/service for service management on Debian

In Debian jessie systemd will be the default init system. But the old system V
and other alternative init systems are still supported. /usr/sbin/service
provides an abstraction layer which is able to start, stop and restart
services independent of the init system used.

Bug: https://tickets.puppetlabs.com/browse/PUP-2023
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775795
---
Index: puppet/lib/puppet/provider/service/debian.rb
===================================================================
--- puppet.orig/lib/puppet/provider/service/debian.rb	2015-02-05 12:07:37.451292892 +0100
+++ puppet/lib/puppet/provider/service/debian.rb	2015-02-05 12:13:06.500095957 +0100
@@ -16,6 +16,11 @@
   # is resolved.
   commands :invoke_rc => "/usr/sbin/invoke-rc.d"
 
+  # This isn't being used directly, it's just here to ensure
+  # that the /usr/sbin/service binary is available.
+  SERVICE = "/usr/sbin/service"
+  commands :service_cmd => SERVICE
+
   defaultfor :operatingsystem => :debian
 
   # Remove the symlinks
@@ -61,4 +66,28 @@
     update_rc "-f", @resource[:name], "remove"
     update_rc @resource[:name], "defaults"
   end
+
+  # The start, stop, restart and status command use service
+  # this makes sure that these commands work with whatever init
+  # system is installed
+  def startcmd
+    [SERVICE, @resource[:name], :start]
+  end
+
+  # The stop command is just the init script with 'stop'.
+  def stopcmd
+    [SERVICE, @resource[:name], :stop]
+  end
+
+  def restartcmd
+    (@resource[:hasrestart] == :true) && [SERVICE, @resource[:name], :restart]
+  end
+
+  # If it was specified that the init script has a 'status' command, then
+  # we just return that; otherwise, we return false, which causes it to
+  # fallback to other mechanisms.
+  def statuscmd
+    (@resource[:hasstatus] == :true) && [SERVICE, @resource[:name], :status]
+  end
+
 end