summaryrefslogtreecommitdiffstats
path: root/install/tools
diff options
context:
space:
mode:
authorStanislav Laznicka <slaznick@redhat.com>2016-04-25 10:11:55 +0200
committerMartin Basti <mbasti@redhat.com>2016-05-10 17:31:25 +0200
commit7098d98100d61f9ed2efc6d4db635c24f9786040 (patch)
tree48ae9eb0ad2cf827b13a3d863c8d1f8c3de4ca4b /install/tools
parentbede6c282e6d321c348dc2d33c6d1f9c14093a57 (diff)
downloadfreeipa-7098d98100d61f9ed2efc6d4db635c24f9786040.tar.gz
freeipa-7098d98100d61f9ed2efc6d4db635c24f9786040.tar.xz
freeipa-7098d98100d61f9ed2efc6d4db635c24f9786040.zip
Fix to clean-dangling-ruv for single CA topologies
clean-dangling-ruv would fail in topologies with only one CA or when only one IPA server is present https://fedorahosted.org/freeipa/ticket/5840 Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'install/tools')
-rwxr-xr-xinstall/tools/ipa-replica-manage54
1 files changed, 33 insertions, 21 deletions
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 8920c402a..14e768965 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -674,32 +674,44 @@ def clean_dangling_ruvs(realm, host, options):
.format(host=master_cn))
offlines.add(master_cn)
continue
-
try:
- entry = conn.get_entry(replica_dn)
- ruv = (master_cn, entry.single_value.get('nsDS5ReplicaID'))
- # the check whether ruv is already in ruvs is performed by set type
- ruvs.add(ruv)
-
- if(master_info['ca']):
- entry = conn.get_entry(csreplica_dn)
- csruv = (master_cn, entry.single_value.get('nsDS5ReplicaID'))
- csruvs.add(csruv)
-
- # get_ruv returns server names with :port which needs to be split off
- ruv_list = get_ruv(realm, master_cn, options.dirman_passwd,
- options.nolookup)
- master_info['ruvs'] = set([
- (re.sub(':\d+', '', x), y)
- for (x, y) in ruv_list
- ])
+ try:
+ entry = conn.get_entry(replica_dn)
+ ruv = (master_cn, entry.single_value.get('nsDS5ReplicaID'))
+ # the check whether ruv is already in ruvs is performed
+ # by the set type
+ ruvs.add(ruv)
+ except errors.NotFound:
+ pass
if master_info['ca']:
- ruv_list = get_ruv(realm, master_cn, options.dirman_passwd,
- options.nolookup, ca=True)
+ try:
+ entry = conn.get_entry(csreplica_dn)
+ csruv = (master_cn,
+ entry.single_value.get('nsDS5ReplicaID'))
+ csruvs.add(csruv)
+ except errors.NotFound:
+ pass
+
+ try:
+ ruv_dict = get_ruv_both_suffixes(realm, master_cn,
+ options.dirman_passwd,
+ options.verbose,
+ options.nolookup)
+ except (RuntimeError, NoRUVsFound):
+ continue
+
+ # get_ruv_both_suffixes returns server names with :port
+ # This needs needs to be split off
+ if ruv_dict.get('domain'):
+ master_info['ruvs'] = set([
+ (re.sub(':\d+', '', x), y)
+ for (x, y) in ruv_dict['domain']
+ ])
+ if ruv_dict.get('ca'):
master_info['csruvs'] = set([
(re.sub(':\d+', '', x), y)
- for (x, y) in ruv_list
+ for (x, y) in ruv_dict['ca']
])
except Exception as e:
sys.exit("Failed to obtain information from '{host}': {error}"