summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcrit@rhel1.greyoak.com>2008-04-14 21:18:24 -0400
committerRob Crittenden <rcrit@rhel1.greyoak.com>2008-04-14 23:14:16 -0400
commit4eb7c51e59dee8348463e83a50e7fba2f1cf2677 (patch)
treeaf7118ee476f5e5134ef15829a4723035dc977e4
parentb1f58e5441eeb371a55d1f54d4f33bdf65a1c2f1 (diff)
downloadfreeipa.git-4eb7c51e59dee8348463e83a50e7fba2f1cf2677.tar.gz
freeipa.git-4eb7c51e59dee8348463e83a50e7fba2f1cf2677.tar.xz
freeipa.git-4eb7c51e59dee8348463e83a50e7fba2f1cf2677.zip
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
-rw-r--r--ipa-server/ipaserver/dsinstance.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/ipa-server/ipaserver/dsinstance.py b/ipa-server/ipaserver/dsinstance.py
index cd89d31e..a56a8a81 100644
--- a/ipa-server/ipaserver/dsinstance.py
+++ b/ipa-server/ipaserver/dsinstance.py
@@ -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