From c8846bab2596de7537f677aecc4881665a535d34 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 1 Mar 2013 17:45:41 -0500 Subject: [PATCH] Improve some error handling in ipa-replica-manage If you break a replica install after the agreement is created but before it gets much further you'll be in the situation where an agreement exists, no cn=masters entry exists, and the RUV may not be set yet. This adds some error handling so the broken install can be safely removed. https://fedorahosted.org/freeipa/ticket/3444 --- install/tools/ipa-replica-manage | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage index 27a7454ab..636529caa 100755 --- a/install/tools/ipa-replica-manage +++ b/install/tools/ipa-replica-manage @@ -654,8 +654,11 @@ def del_master(realm, hostname, options): for master_cn in [m.single_value('cn') for m in masters]: master_dn = DN(('cn', master_cn), ('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'), ipautil.realm_to_suffix(realm)) - services = delrepl.conn.get_entries(master_dn, - delrepl.conn.SCOPE_ONELEVEL) + try: + services = delrepl.conn.get_entries(master_dn, + delrepl.conn.SCOPE_ONELEVEL) + except errors.NotFound: + continue services_cns = [s.single_value('cn') for s in services] if master_cn == hostname: @@ -690,7 +693,7 @@ def del_master(realm, hostname, options): "from %s: %s" % (hostname, r, e)) # 5. Clean RUV for the deleted master - if repltype == replication.IPA_REPLICA: + if repltype == replication.IPA_REPLICA and rid is not None: try: thisrepl.cleanallruv(rid) except KeyboardInterrupt: