Refactor some replication code

This simplifies or rationalizes some code in order to make it easier to change
it to fix bug #690
This commit is contained in:
Simo Sorce
2011-01-10 10:57:43 -05:00
parent a68b2d2aa3
commit 2255479ef0
3 changed files with 137 additions and 155 deletions

View File

@@ -287,14 +287,12 @@ class DsInstance(service.Service):
def __setup_replica(self):
try:
repl = replication.ReplicationManager(self.fqdn, self.dm_password)
ret = repl.setup_replication(self.master_fqdn, self.realm_name)
except Exception, e:
logging.debug("Connection error: %s" % e)
raise RuntimeError("Unable to connect to LDAP server %s." % self.fqdn)
if ret != 0:
raise RuntimeError("Failed to start replication")
repl = replication.ReplicationManager(self.realm_name,
self.fqdn,
self.dm_password)
repl.setup_replication(self.master_fqdn,
"cn=Directory Manager",
self.dm_password)
def __enable(self):
self.backup_state("enabled", self.is_enabled())