mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Better detection of DS not starting.
The dirsrv init script always returns 0 on status checks, even if an instance is not started. So we have to look through the output instead. 442452
This commit is contained in:
parent
b1f58e5441
commit
4eb7c51e59
@ -87,6 +87,21 @@ def check_ports():
|
||||
ds_secure = installutils.port_available(636)
|
||||
return (ds_unsecure, ds_secure)
|
||||
|
||||
def is_ds_running():
|
||||
"""The DS init script always returns 0 when requesting status so it cannot
|
||||
be used to determine if the server is running. We have to look at the
|
||||
output.
|
||||
"""
|
||||
ret = True
|
||||
try:
|
||||
(sout, serr) = ipautil.run(["/sbin/service", "dirsrv", "status"])
|
||||
if sout.find("is stopped") >= 0:
|
||||
ret = False
|
||||
except ipautil.CalledProcessError:
|
||||
ret = False
|
||||
return ret
|
||||
|
||||
|
||||
INF_TEMPLATE = """
|
||||
[General]
|
||||
FullMachineName= $FQHN
|
||||
@ -192,7 +207,7 @@ class DsInstance(service.Service):
|
||||
self.backup_state("user_exists", user_exists)
|
||||
|
||||
def __create_instance(self):
|
||||
self.backup_state("running", self.is_running())
|
||||
self.backup_state("running", is_ds_running())
|
||||
self.backup_state("serverid", self.serverid)
|
||||
|
||||
self.sub_dict['BASEDC'] = self.realm_name[:self.realm_name.find('.')].lower()
|
||||
@ -242,9 +257,14 @@ class DsInstance(service.Service):
|
||||
def __restart_instance(self):
|
||||
try:
|
||||
self.restart()
|
||||
except:
|
||||
if not is_ds_running():
|
||||
logging.critical("Failed to restart the directory server. See the installation log for details.")
|
||||
sys.exit(1)
|
||||
except SystemExit, e:
|
||||
raise e
|
||||
except Exception, e:
|
||||
# TODO: roll back here?
|
||||
logging.critical("Failed to restart the ds instance")
|
||||
logging.critical("Failed to restart the directory server. See the installation log for details.")
|
||||
|
||||
def __ldap_mod(self, ldif, sub_dict = None):
|
||||
fd = None
|
||||
|
Loading…
Reference in New Issue
Block a user