summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-replica-manage
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:52:56 -0400
commitc8846bab2596de7537f677aecc4881665a535d34 (patch)
treed2796f26526a65d4bc5417953468a1bce8b0a28f /install/tools/ipa-replica-manage
parent66356f0daf2a55c7e64dc648e0f8c765e9a56151 (diff)
downloadfreeipa-c8846bab2596de7537f677aecc4881665a535d34.tar.gz
freeipa-c8846bab2596de7537f677aecc4881665a535d34.tar.xz
freeipa-c8846bab2596de7537f677aecc4881665a535d34.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
Diffstat (limited to 'install/tools/ipa-replica-manage')
-rwxr-xr-xinstall/tools/ipa-replica-manage9
1 files 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: