This is an automated email from the git hooks/post-receive script.
firstyear pushed a commit to branch master
in repository 389-ds-base.
commit f52aeb5cc2fbe24f4a6f45668aa12d1603cb6921
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Nov 20 19:18:30 2013 -0700
added agreement stop and restart methods
Reviewed by: tbordaz (Thanks!)
---
src/lib389/lib389/brooker.py | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/src/lib389/lib389/brooker.py b/src/lib389/lib389/brooker.py
index fe54d01..a51a92b 100644
--- a/src/lib389/lib389/brooker.py
+++ b/src/lib389/lib389/brooker.py
@@ -425,6 +425,8 @@ class Agreement(object):
class Replica(object):
proxied_methods = 'search_s getEntry'.split()
+ STOP = '2358-2359 0'
+ START = '0000-2359 0123456'
def __init__(self, conn):
"""@param conn - a DirSrv instance"""
@@ -591,6 +593,42 @@ class Replica(object):
self.log.info("Setting agreement for continuous replication")
raise NotImplementedError("Check nsds5replicaupdateschedule before
writing!")
+ def stop(self, agmtdn):
+ """Stop replication.
+ @param agmtdn - agreement dn
+ """
+ self.log.info("Stopping replication %s" % agmtdn)
+ mod = [(
+ ldap.MOD_REPLACE, 'nsds5ReplicaEnabled', ['off'])]
+ try:
+ self.conn.modify_s(agmtdn, mod)
+ except LDAPError, e:
+ # before 1.2.11, no support for nsds5ReplicaEnabled
+ # use schedule hack
+ mod = [(
+ ldap.MOD_REPLACE, 'nsds5replicaupdateschedule', [
+ Replica.STOP])]
+ self.conn.modify_s(agmtdn, mod)
+
+ def restart(self, agmtdn, schedule=START):
+ """Schedules a new replication.
+ @param agmtdn -
+ @param schedule - default START
+ `schedule` allows to customize the replication instant.
+ see 389 documentation for further info
+ """
+ self.log.info("Restarting replication %s" % agmtdn)
+ mod = [(
+ ldap.MOD_REPLACE, 'nsds5ReplicaEnabled', ['on'])]
+ try:
+ self.conn.modify_s(agmtdn, mod)
+ except LDAPError, e:
+ # before 1.2.11, no support for nsds5ReplicaEnabled
+ # use schedule hack
+ mod = [(ldap.MOD_REPLACE, 'nsds5replicaupdateschedule', [
+ schedule])]
+ self.conn.modify_s(agmtdn, mod)
+
def add(self, suffix, binddn, bindpw=None, rtype=REPLICA_RDONLY_TYPE, rid=None,
tombstone_purgedelay=None, purgedelay=None, referrals=None, legacy=False):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.