summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-04-12 18:40:20 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-04-12 18:40:20 +0200
commit2f989a0b931b78cb0a4e5696d1b8393c32012778 (patch)
treedc7dd507e77cb10f01ce46bd34b5ab3de94a90b1 /pykolab
parent7329ac9b1ebe66522ddec7f11644703e065a5056 (diff)
downloadpykolab-2f989a0b931b78cb0a4e5696d1b8393c32012778.tar.gz
Pull the 389 Directory Server setup returncode and act accordingly
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_ldap.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index be3b38a..34e6111 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -288,7 +288,24 @@ ServerAdminPwd = %(admin_pass)s
(stdoutdata, stderrdata) = setup_389.communicate()
- # TODO: Get the return code and display output if not successful.
+ if not setup_389.returncode == 0:
+ print >> sys.stderr, utils.multiline_message(
+ _("""
+ An error was detected in the setup procedure for 389
+ Directory Server. This setup will write out stderr and
+ stdout to /var/log/kolab/setup.error.log and
+ /var/log/kolab/setup.out.log respectively, before it
+ exits.
+ """)
+ )
+
+ fp = open('/var/log/kolab/setup.error.log', 'w')
+ fp.write(stderrdata)
+ fp.close()
+
+ fp = open('/var/log/kolab/setup.out.log', 'w')
+ fp.write(stderrdata)
+ fp.close()
log.debug(_("Setup DS stdout:"), level=8)
log.debug(stdoutdata, level=8)
@@ -296,9 +313,8 @@ ServerAdminPwd = %(admin_pass)s
log.debug(_("Setup DS stderr:"), level=8)
log.debug(stderrdata, level=8)
- # TODO: Fails when ran a second time.
-
- # TODO: When fail, fail gracefully.
+ if not setup_389.returncode == 0:
+ sys.exit(1)
# Find the kolab schema. It's installed as %doc in the kolab-schema package.
# TODO: Chown nobody, nobody, chmod 440
@@ -317,6 +333,7 @@ ServerAdminPwd = %(admin_pass)s
os.path.basename(schema_file)
)
)
+
schema_error = False
except:
log.error(_("Could not copy the LDAP extensions for Kolab"))