summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/replication.py
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-01-21 14:32:55 -0500
committerSimo Sorce <ssorce@redhat.com>2011-01-25 11:10:27 -0500
commit5bc7e5a9c790c80f73b82f8ef175799b3c84eaaa (patch)
treedfed0a5d4e97f3fa07732b19ac7348162add12d3 /ipaserver/install/replication.py
parent82b4d5d6e8fba52c63831c6aec6b08e604082132 (diff)
downloadfreeipa-5bc7e5a9c790c80f73b82f8ef175799b3c84eaaa.tar.gz
freeipa-5bc7e5a9c790c80f73b82f8ef175799b3c84eaaa.tar.xz
freeipa-5bc7e5a9c790c80f73b82f8ef175799b3c84eaaa.zip
Populate shared tree with replica related values
Fixes: https://fedorahosted.org/freeipa/ticket/820
Diffstat (limited to 'ipaserver/install/replication.py')
-rw-r--r--ipaserver/install/replication.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 21e6bcc4..3c2f3c18 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -730,6 +730,11 @@ class ReplicationManager:
return IPA_REPLICA
def replica_cleanup(self, replica, realm, force=False):
+ """
+ This function removes information about the replica in parts
+ of the shared tree that expose it, so clients stop trying to
+ use this replica.
+ """
err = None
@@ -790,6 +795,30 @@ class ReplicationManager:
except errors.NotFound:
pass
except Exception, e:
+ if not force:
+ raise e
+ elif not err:
+ err = e
+
+ try:
+ dn = 'cn=default,ou=profile,%s' % self.suffix
+ ret = self.conn.search_s(dn, ldap.SCOPE_BASE,
+ '(objectclass=*)')[0]
+ srvlist = ret.data.get('defaultServerList')
+ if len(srvlist) > 0:
+ srvlist = srvlist[0].split()
+ if replica in srvlist:
+ srvlist.remove(replica)
+ attr = ' '.join(srvlist)
+ mod = [(ldap.MOD_REPLACE, 'defaultServerList', attr)]
+ self.conn.modify_s(dn, mod)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ except ldap.NO_SUCH_ATTRIBUTE:
+ pass
+ except ldap.TYPE_OR_VALUE_EXISTS:
+ pass
+ except Exception, e:
if force and err:
raise err
else: