Fix.

On 05/13/2016 03:43 PM, Stanislav Laznicka wrote:
Got distracted with the code, beautifying replacement of previous patch attached.


On 05/13/2016 03:30 PM, Stanislav Laznicka wrote:
https://fedorahosted.org/freeipa/ticket/5307

Please see the patch attached.






From 3655cc590ba7d1fb4cf3d2b25fd54e21be3e91fa Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Fri, 13 May 2016 15:13:21 +0200
Subject: [PATCH] fixes premature sys.exit in ipa-replica-manage del

Deletion of a replica would fail should there
be no RUVs on the server

https://fedorahosted.org/freeipa/ticket/5307
---
 install/tools/ipa-replica-manage | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 14e768965601cef08f13792bb5cd086534199538..5f5e63708ed1664d6ccda8eb7db9e83c02336f7d 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -465,9 +465,12 @@ def get_rid_by_host(realm, sourcehost, host, dirman_passwd, nolookup=False):
     """
     try:
         servers = get_ruv(realm, sourcehost, dirman_passwd, nolookup)
-    except (NoRUVsFound, RuntimeError) as e:
+    except RuntimeError as e:
         print(e)
-        sys.exit(0 if isinstance(e, NoRUVsFound) else 1)
+        sys.exit(1)
+    except NoRUVsFound as e:
+        print(e)
+        servers = []
     for (netloc, rid) in servers:
         if '%s:389' % host == netloc:
             return int(rid)
@@ -962,10 +965,6 @@ def del_master_managed(realm, hostname, options):
     #    And pick new CA master.
     ensure_last_services(api.Backend.ldap2, hostname, masters, options)
 
-    # Save the RID value before we start deleting
-    rid = get_rid_by_host(realm, options.host, hostname,
-                          options.dirman_passwd, options.nolookup)
-
     # 5. Remove master entry. Topology plugin will remove replication agreements.
     try:
         api.Command.server_del(hostname_u)
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to