mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
parent
9f70178149
commit
98eefab5e1
@ -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)
|
||||
|
||||
|
@ -98,7 +98,7 @@ def print_msg(message, output_fd=sys.stdout):
|
||||
output_fd.write("\n")
|
||||
|
||||
|
||||
class Service:
|
||||
class Service(object):
|
||||
def __init__(self, service_name, sstore=None, dm_password=None):
|
||||
self.service_name = service_name
|
||||
self.steps = []
|
||||
|
Loading…
Reference in New Issue
Block a user