summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/dsinstance.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-04-27 12:37:04 +0200
committerMartin Kosek <mkosek@redhat.com>2011-04-28 09:59:34 +0200
commit98eefab5e15c4a01f0887c4c68cbe10b5cdaab84 (patch)
tree497ef8eb8e3a2b040d004711b9b7147610832483 /ipaserver/install/dsinstance.py
parent9f701781490e8544761eca464db528228021931e (diff)
downloadfreeipa-98eefab5e15c4a01f0887c4c68cbe10b5cdaab84.zip
freeipa-98eefab5e15c4a01f0887c4c68cbe10b5cdaab84.tar.gz
freeipa-98eefab5e15c4a01f0887c4c68cbe10b5cdaab84.tar.xz
Improve Directory Service open port checker
Wait for DS ports to open after _every_ DS service restart. Several restarts were missed by the current open port checker implementation. https://fedorahosted.org/freeipa/ticket/1182
Diffstat (limited to 'ipaserver/install/dsinstance.py')
-rw-r--r--ipaserver/install/dsinstance.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 38195c7..74243cf 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -183,6 +183,7 @@ class DsInstance(service.Service):
self.idstart = None
self.idmax = None
self.subject_base = None
+ self.open_ports = []
if realm_name:
self.suffix = util.realm_to_suffix(self.realm_name)
self.__setup_sub_dict()
@@ -376,9 +377,13 @@ class DsInstance(service.Service):
logging.debug("completed creating ds instance")
except ipautil.CalledProcessError, e:
logging.critical("failed to restart ds instance %s" % e)
+
+ # check for open port 389 from now on
+ self.open_ports.append(389)
+
logging.debug("restarting ds instance")
try:
- self.restart(self.serverid)
+ self.__restart_instance()
logging.debug("done restarting ds instance")
except ipautil.CalledProcessError, e:
print "failed to restart ds instance", e
@@ -406,18 +411,21 @@ class DsInstance(service.Service):
# Does not apply with newer DS releases
pass
- def __restart_instance(self):
+ def restart(self, instance=''):
try:
- self.restart(self.serverid)
+ super(DsInstance, self).restart(instance)
if not is_ds_running():
logging.critical("Failed to restart the directory server. See the installation log for details.")
sys.exit(1)
- installutils.wait_for_open_ports('localhost', [389, 636], 300)
+ installutils.wait_for_open_ports('localhost', self.open_ports, 300)
except SystemExit, e:
raise e
except Exception, e:
# TODO: roll back here?
- logging.critical("Failed to restart the directory server. See the installation log for details.")
+ logging.critical("Failed to restart the directory server (%s). See the installation log for details." % e)
+
+ def __restart_instance(self):
+ self.restart(self.serverid)
def __enable_entryusn(self):
self._ldap_mod("entryusn.ldif")
@@ -549,6 +557,9 @@ class DsInstance(service.Service):
conn.unbind()
+ # check for open secure port 636 from now on
+ self.open_ports.append(636)
+
def __add_default_layout(self):
self._ldap_mod("bootstrap-template.ldif", self.sub_dict)