diff options
author | Rob Crittenden <rcritten@redhat.com> | 2012-01-16 10:24:15 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-01-30 17:27:55 +0100 |
commit | 7a1399bee1547b85186e010720a90ed6ab2f5e22 (patch) | |
tree | 0f3043f5b7a8d6d92767a6e0729624db3b7cde58 /ipaserver/install/replication.py | |
parent | ce360f37f884f76512c3d806819267a214352970 (diff) | |
download | freeipa-7a1399bee1547b85186e010720a90ed6ab2f5e22.tar.gz freeipa-7a1399bee1547b85186e010720a90ed6ab2f5e22.tar.xz freeipa-7a1399bee1547b85186e010720a90ed6ab2f5e22.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/install/replication.py')
-rw-r--r-- | ipaserver/install/replication.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py index 052f18346..6f6372514 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. |