pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone
Blob Blame History Raw
From a7fffdc2685b82546c620c19fbbda545ba1b8e90 Mon Sep 17 00:00:00 2001
From: Tomas Babej <tomasbabej@gmail.com>
Date: Thu, 21 Nov 2013 15:25:27 +0100
Subject: [PATCH 09/10] trusts: Always stop and disable smb service on
 uninstall

https://fedorahosted.org/freeipa/ticket/4042
---
 ipaserver/install/adtrustinstance.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
index 6a1ede0d7eb46a824d6e9eaf7ad1226120d08809..4aa8322e3e2cfb6fbc07696097c3e6e21fc7f665 100644
--- a/ipaserver/install/adtrustinstance.py
+++ b/ipaserver/install/adtrustinstance.py
@@ -881,11 +881,16 @@ def uninstall(self):
         if self.is_configured():
             self.print_msg("Unconfiguring %s" % self.service_name)
 
-        running = self.restore_state("running")
-        enabled = self.restore_state("enabled")
+        # Call restore_state so that we do not leave mess in the statestore
+        # Otherwise this does nothing
+        self.restore_state("running")
+        self.restore_state("enabled")
 
+        # Always try to stop and disable smb service, since we do not leave
+        # working configuration after uninstall
         try:
             self.stop()
+            self.disable()
         except:
             pass
 
@@ -917,9 +922,3 @@ def uninstall(self):
 
         # Remove our keys from samba's keytab
         self.clean_samba_keytab()
-
-        if not enabled is None and not enabled:
-            self.disable()
-
-        if not running is None and running:
-            self.start()
-- 
1.8.3.1