The Identity, Policy and Audit system
CentOS Sources
2016-11-03 403b09ab980c02ef36095973349a13e0181c794a
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
From 90b827a6d23d864bfac96d2ff0f89f1a3ba1d245 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slaznick@redhat.com>
Date: Fri, 12 Aug 2016 11:59:41 +0200
Subject: [PATCH] Fail on topology disconnect/last role removal
 
Disconnecting topology/removing last-role-host during server
uninstallation should raise error rather than just being logged
if the appropriate ignore settings are not present.
 
https://fedorahosted.org/freeipa/ticket/6168
 
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
---
 ipaserver/install/server/install.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
 
diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index 94698898934844350488d5fc52d6e1e567624502..86b8402750b503ea7dacd1f4c59c82d9bd4082e6 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -25,6 +25,7 @@ from ipapython.ipa_log_manager import root_logger
 from ipapython.ipautil import (
     decrypt_file, format_netloc, ipa_generate_password, run, user_input,
     is_fips_enabled)
+from ipapython.admintool import ScriptError
 from ipaplatform import services
 from ipaplatform.paths import paths
 from ipaplatform.tasks import tasks
@@ -294,7 +295,6 @@ def common_cleanup(func):
 def remove_master_from_managed_topology(api_instance, options):
     try:
         # we may force the removal
-        # if the master was already deleted we will just get a warning
         server_del_options = dict(
             force=True,
             ignore_topology_disconnect=options.ignore_topology_disconnect,
@@ -303,8 +303,10 @@ def remove_master_from_managed_topology(api_instance, options):
 
         replication.run_server_del_as_cli(
             api_instance, api_instance.env.host, **server_del_options)
-
+    except errors.ServerRemovalError as e:
+        raise ScriptError(str(e))
     except Exception as e:
+        # if the master was already deleted we will just get a warning
         root_logger.warning("Failed to delete master: {}".format(e))
 
 
-- 
2.9.3