9991ea
From a7fffdc2685b82546c620c19fbbda545ba1b8e90 Mon Sep 17 00:00:00 2001
9991ea
From: Tomas Babej <tomasbabej@gmail.com>
9991ea
Date: Thu, 21 Nov 2013 15:25:27 +0100
9991ea
Subject: [PATCH 09/10] trusts: Always stop and disable smb service on
9991ea
 uninstall
9991ea
9991ea
https://fedorahosted.org/freeipa/ticket/4042
9991ea
---
9991ea
 ipaserver/install/adtrustinstance.py | 15 +++++++--------
9991ea
 1 file changed, 7 insertions(+), 8 deletions(-)
9991ea
9991ea
diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
9991ea
index 6a1ede0d7eb46a824d6e9eaf7ad1226120d08809..4aa8322e3e2cfb6fbc07696097c3e6e21fc7f665 100644
9991ea
--- a/ipaserver/install/adtrustinstance.py
9991ea
+++ b/ipaserver/install/adtrustinstance.py
9991ea
@@ -881,11 +881,16 @@ def uninstall(self):
9991ea
         if self.is_configured():
9991ea
             self.print_msg("Unconfiguring %s" % self.service_name)
9991ea
 
9991ea
-        running = self.restore_state("running")
9991ea
-        enabled = self.restore_state("enabled")
9991ea
+        # Call restore_state so that we do not leave mess in the statestore
9991ea
+        # Otherwise this does nothing
9991ea
+        self.restore_state("running")
9991ea
+        self.restore_state("enabled")
9991ea
 
9991ea
+        # Always try to stop and disable smb service, since we do not leave
9991ea
+        # working configuration after uninstall
9991ea
         try:
9991ea
             self.stop()
9991ea
+            self.disable()
9991ea
         except:
9991ea
             pass
9991ea
 
9991ea
@@ -917,9 +922,3 @@ def uninstall(self):
9991ea
 
9991ea
         # Remove our keys from samba's keytab
9991ea
         self.clean_samba_keytab()
9991ea
-
9991ea
-        if not enabled is None and not enabled:
9991ea
-            self.disable()
9991ea
-
9991ea
-        if not running is None and running:
9991ea
-            self.start()
9991ea
-- 
9991ea
1.8.3.1
9991ea