From 0e11e4c86f580142d6268dcb281c07fc02dd529f Mon Sep 17 00:00:00 2001 From: "Jasper N. Brouwer" Date: Wed, 4 Dec 2013 21:49:00 +0100 Subject: [PATCH 1/2] Fixed false positive on initctl as enable_cmd Also on update-rc.d In service module --- library/system/service | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/system/service b/library/system/service index aac7319d753..2490c6a30fd 100644 --- a/library/system/service +++ b/library/system/service @@ -431,10 +431,10 @@ class LinuxService(Service): if check_systemd(self.name): # service is managed by systemd self.enable_cmd = location['systemctl'] - elif os.path.exists("/etc/init/%s.conf" % self.name): + elif os.path.exists("/etc/init/%s.conf" % self.name) and location['initctl']: # service is managed by upstart self.enable_cmd = location['initctl'] - elif os.path.exists("/etc/init.d/%s" % self.name): + elif os.path.exists("/etc/init.d/%s" % self.name) and location['update-rc.d']: # service is managed by with SysV init scripts, but with update-rc.d self.enable_cmd = location['update-rc.d'] else: @@ -649,7 +649,7 @@ class LinuxService(Service): return if self.enable: - # make sure the init.d symlinks are created + # make sure the init.d symlinks are created # otherwise enable might not work (rc, out, err) = self.execute_command("%s %s defaults" \ % (self.enable_cmd, self.name)) From a52ca73167abf4e5687f19a704ad7c7a90d1404a Mon Sep 17 00:00:00 2001 From: "Jasper N. Brouwer" Date: Mon, 23 Dec 2013 09:54:16 +0100 Subject: [PATCH 2/2] Swapped conditions of the changed if statements --- library/system/service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/system/service b/library/system/service index 2490c6a30fd..ed5712c09f9 100644 --- a/library/system/service +++ b/library/system/service @@ -431,10 +431,10 @@ class LinuxService(Service): if check_systemd(self.name): # service is managed by systemd self.enable_cmd = location['systemctl'] - elif os.path.exists("/etc/init/%s.conf" % self.name) and location['initctl']: + elif location['initctl'] and os.path.exists("/etc/init/%s.conf" % self.name): # service is managed by upstart self.enable_cmd = location['initctl'] - elif os.path.exists("/etc/init.d/%s" % self.name) and location['update-rc.d']: + elif location['update-rc.d'] and os.path.exists("/etc/init.d/%s" % self.name): # service is managed by with SysV init scripts, but with update-rc.d self.enable_cmd = location['update-rc.d'] else: