summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-01-16 10:24:15 -0500
committerMartin Kosek <mkosek@redhat.com>2012-01-30 17:28:18 +0100
commitbf29b44942160b30eb9ed347bf5b6c8f30418d6e (patch)
tree4f7809b7a9ea2e22cef486152fa1a548839d80b5 /ipaserver
parent46a472ef20ae3b25a2e4c4f92b26127e73f8f7a4 (diff)
downloadfreeipa.git-bf29b44942160b30eb9ed347bf5b6c8f30418d6e.tar.gz
freeipa.git-bf29b44942160b30eb9ed347bf5b6c8f30418d6e.tar.xz
freeipa.git-bf29b44942160b30eb9ed347bf5b6c8f30418d6e.zip
Check for the existence of a replication agreement before deleting it.
When using ipa-replica-manage or ipa-csreplica-manage to delete an agreement with a host we would try to make a connection to that host prior to tryign to delete it. This meant that the trying to delete a host we don't have an agreement with would return a connection error instead of a "no agreement with host foo" error. Also display a completed message when an agreement is removed. https://fedorahosted.org/freeipa/ticket/2048 https://fedorahosted.org/freeipa/ticket/2125
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/replication.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 052f1834..6f637251 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -211,6 +211,28 @@ class ReplicationManager(object):
return res
+ def get_replication_agreement(self, hostname):
+ """
+ The replication agreements are stored in
+ cn="$SUFFIX",cn=mapping tree,cn=config
+
+ Get the replication agreement for a specific host.
+
+ Returns None if not found.
+ """
+
+ filt = "(&(objectclass=nsds5ReplicationAgreement)(nsDS5ReplicaHost=%s))" % hostname
+ try:
+ entry = self.conn.search_s("cn=mapping tree,cn=config",
+ ldap.SCOPE_SUBTREE, filt)
+ except ldap.NO_SUCH_OBJECT:
+ return None
+
+ if len(entry) == 0:
+ return None
+ else:
+ return entry[0] # There can be only one
+
def add_replication_manager(self, conn, dn, pw):
"""
Create a pseudo user to use for replication.