summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2013-03-01 17:45:41 -0500
committerRob Crittenden <rcritten@redhat.com>2013-03-14 13:53:10 -0400
commit6fb2199888eea4acc538a965d1df665653661e92 (patch)
treef950126ae5005bf0183572dd6974a32095b53504
parent49577a4c66fe4260946f9bf132ad12bdcc213662 (diff)
downloadfreeipa.git-6fb2199888eea4acc538a965d1df665653661e92.tar.gz
freeipa.git-6fb2199888eea4acc538a965d1df665653661e92.tar.xz
freeipa.git-6fb2199888eea4acc538a965d1df665653661e92.zip
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
-rwxr-xr-xinstall/tools/ipa-replica-manage7
1 files changed, 5 insertions, 2 deletions
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 698a02f5..e78f9d27 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -635,7 +635,10 @@ def del_master(realm, hostname, options):
for master_cn in [m.getValue('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.getList(master_dn, ldap.SCOPE_ONELEVEL)
+ try:
+ services = delrepl.conn.getList(master_dn, ldap.SCOPE_ONELEVEL)
+ except (ldap.NO_SUCH_OBJECT, errors.NotFound):
+ continue
services_cns = [s.getValue('cn') for s in services]
if master_cn == hostname:
@@ -669,7 +672,7 @@ def del_master(realm, hostname, options):
print "There were issues removing a connection for %s from %s: %s" % (hostname, r, convert_error(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: