|
|
ac7d03 |
From 2a20fbe381dd8a740e05833dd8d2b5440ce84812 Mon Sep 17 00:00:00 2001
|
|
|
ac7d03 |
From: Martin Babinsky <mbabinsk@redhat.com>
|
|
|
ac7d03 |
Date: Tue, 23 May 2017 16:35:01 +0200
|
|
|
ac7d03 |
Subject: [PATCH] only stop/disable simple service if it is installed
|
|
|
ac7d03 |
|
|
|
ac7d03 |
The SimpleServiceInstance uninstaller assument that the service to
|
|
|
ac7d03 |
uninstall was always present on the system. This may not be valid in
|
|
|
ac7d03 |
some cases (e.g. containerized deployments) and thus we need to change
|
|
|
ac7d03 |
the service state only when we know that the unit file exists.
|
|
|
ac7d03 |
|
|
|
ac7d03 |
https://pagure.io/freeipa/issue/6977
|
|
|
ac7d03 |
|
|
|
ac7d03 |
Reviewed-By: Martin Basti <mbasti@redhat.com>
|
|
|
ac7d03 |
---
|
|
|
ac7d03 |
ipaserver/install/service.py | 19 +++++++++++--------
|
|
|
ac7d03 |
1 file changed, 11 insertions(+), 8 deletions(-)
|
|
|
ac7d03 |
|
|
|
ac7d03 |
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
|
|
|
ac7d03 |
index 1aa49ed25b25366afd2bb17073b4b214c231d54b..0523e914aa7debf6aaa82ddcce9b7b26c1833cd3 100644
|
|
|
ac7d03 |
--- a/ipaserver/install/service.py
|
|
|
ac7d03 |
+++ b/ipaserver/install/service.py
|
|
|
ac7d03 |
@@ -674,18 +674,21 @@ class SimpleServiceInstance(Service):
|
|
|
ac7d03 |
else:
|
|
|
ac7d03 |
self.ldap_enable(self.gensvc_name, self.fqdn, None, self.suffix)
|
|
|
ac7d03 |
|
|
|
ac7d03 |
+ def is_installed(self):
|
|
|
ac7d03 |
+ return self.service.is_installed()
|
|
|
ac7d03 |
+
|
|
|
ac7d03 |
def uninstall(self):
|
|
|
ac7d03 |
if self.is_configured():
|
|
|
ac7d03 |
self.print_msg("Unconfiguring %s" % self.service_name)
|
|
|
ac7d03 |
|
|
|
ac7d03 |
- self.stop()
|
|
|
ac7d03 |
- self.disable()
|
|
|
ac7d03 |
-
|
|
|
ac7d03 |
running = self.restore_state("running")
|
|
|
ac7d03 |
enabled = self.restore_state("enabled")
|
|
|
ac7d03 |
|
|
|
ac7d03 |
- # restore the original state of service
|
|
|
ac7d03 |
- if running:
|
|
|
ac7d03 |
- self.start()
|
|
|
ac7d03 |
- if enabled:
|
|
|
ac7d03 |
- self.enable()
|
|
|
ac7d03 |
+ if self.is_installed():
|
|
|
ac7d03 |
+ self.stop()
|
|
|
ac7d03 |
+ self.disable()
|
|
|
ac7d03 |
+
|
|
|
ac7d03 |
+ if running:
|
|
|
ac7d03 |
+ self.start()
|
|
|
ac7d03 |
+ if enabled:
|
|
|
ac7d03 |
+ self.enable()
|
|
|
ac7d03 |
--
|
|
|
ac7d03 |
2.9.4
|
|
|
ac7d03 |
|