Wait for memberof task and DS to start before proceeding in installation.

This was causing a replica DS instance to crash if the task was not
completed when we attempted a shutdown to do a restart.

In replication.py we were restarting the DS instance without waiting
for the ports to become available.

It is unlikely that the dn of the memberof task will change but just in
case I noted it in the two places it is referenced.

ticket 1188
This commit is contained in:
Rob Crittenden
2011-04-21 16:43:10 -04:00
committed by Martin Kosek
parent d2be41dd1b
commit 46a3411420
4 changed files with 34 additions and 0 deletions

View File

@@ -427,6 +427,13 @@ class DsInstance(service.Service):
def init_memberof(self):
self._ldap_mod("memberof-task.ldif", self.sub_dict)
# Note, keep dn in sync with dn in install/share/memberof-task.ldif
dn = "cn=IPA install %s,cn=memberof task,cn=tasks,cn=config" % self.sub_dict["TIME"]
logging.debug("Waiting for memberof task to complete.")
conn = ipaldap.IPAdmin("127.0.0.1")
conn.simple_bind_s("cn=directory manager", self.dm_password)
conn.checkTask(dn, dowait=True)
conn.unbind()
def apply_updates(self):
ld = ldapupdate.LDAPUpdate(dm_password=self.dm_password, sub_dict=self.sub_dict)

View File

@@ -23,6 +23,7 @@ import os
import ldap
from ipaserver import ipaldap
from ipaserver.install.service import restart
import installutils
from ldap import modlist
from ipalib import util
from ipalib import errors
@@ -69,6 +70,7 @@ def enable_replication_version_checking(hostname, realm, dirman_passwd):
conn.unbind()
serverid = "-".join(realm.split("."))
restart("dirsrv", instance_name=serverid)
installutils.wait_for_open_ports('localhost', [389, 636], 300)
else:
conn.unbind()