From 092b1b694c33b28a5b33678b443611d244363c76 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 7 Mar 2008 10:56:03 -0500 Subject: Add ability to initialize a replication agreement Add ability to force a synch to occur Clean up a lot of unused code in ipaldap.py. This lets us do a simple bind without being root (it used to try to read dse.ldif) 436237 --- ipa-server/ipaserver/replication.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ipa-server/ipaserver/replication.py') diff --git a/ipa-server/ipaserver/replication.py b/ipa-server/ipaserver/replication.py index 153780ec..b9e4e6cb 100644 --- a/ipa-server/ipaserver/replication.py +++ b/ipa-server/ipaserver/replication.py @@ -20,6 +20,7 @@ import time, logging import ipaldap, ldap, dsinstance +from ldap import modlist from ipa import ipaerror DIRMAN_CN = "cn=directory manager" @@ -320,3 +321,21 @@ class ReplicationManager: self.setup_agreement(self.conn, other_conn) return self.start_replication(other_conn) + + def initialize_replication(self, dn, conn): + mod = [(ldap.MOD_ADD, 'nsds5BeginReplicaRefresh', 'start')] + try: + conn.modify_s(dn, mod) + except ldap.ALREADY_EXISTS: + return + + def force_synch(self, dn, schedule, conn): + newschedule = '2358-2359 0' + + # On the remote chance of a match. We force a synch to happen right + # now by changing the schedule to something else and quickly changing + # it back. + if newschedule == schedule: + newschedule = '2358-2359 1' + mod = [(ldap.MOD_REPLACE, 'nsDS5ReplicaUpdateSchedule', [ newschedule ])] + conn.modify_s(dn, mod) -- cgit