diff options
author | Jan Cholasta <jcholast@redhat.com> | 2014-01-23 15:33:26 +0100 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-03-10 18:41:10 +0100 |
commit | 8e986904096925fc08df8cbdf271d722314c5460 (patch) | |
tree | ad4fca6b98f049a26df5620eb7691d6a491aea3a /install/restart_scripts/restart_dirsrv | |
parent | d727599aa804aecd91de969a9309c1903d0cfdce (diff) | |
download | freeipa-8e986904096925fc08df8cbdf271d722314c5460.tar.gz freeipa-8e986904096925fc08df8cbdf271d722314c5460.tar.xz freeipa-8e986904096925fc08df8cbdf271d722314c5460.zip |
Log unhandled exceptions in certificate renewal scripts.
https://fedorahosted.org/freeipa/ticket/4093
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'install/restart_scripts/restart_dirsrv')
-rw-r--r-- | install/restart_scripts/restart_dirsrv | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/install/restart_scripts/restart_dirsrv b/install/restart_scripts/restart_dirsrv index 9b22d08c1..03e6a5c42 100644 --- a/install/restart_scripts/restart_dirsrv +++ b/install/restart_scripts/restart_dirsrv @@ -21,20 +21,27 @@ import sys import syslog +import traceback from ipapython import services as ipaservices from ipalib import api -try: - instance = sys.argv[1] -except IndexError: - instance = "" +def main(): + try: + instance = sys.argv[1] + except IndexError: + instance = "" + + api.bootstrap(context='restart') + api.finalize() -api.bootstrap(context='restart') -api.finalize() + syslog.syslog(syslog.LOG_NOTICE, "certmonger restarted dirsrv instance '%s'" % instance) -syslog.syslog(syslog.LOG_NOTICE, "certmonger restarted dirsrv instance '%s'" % instance) + try: + ipaservices.knownservices.dirsrv.restart(instance) + except Exception, e: + syslog.syslog(syslog.LOG_ERR, "Cannot restart dirsrv (instance: '%s'): %s" % (instance, str(e))) try: - ipaservices.knownservices.dirsrv.restart(instance) -except Exception, e: - syslog.syslog(syslog.LOG_ERR, "Cannot restart dirsrv (instance: '%s'): %s" % (instance, str(e))) + main() +except Exception: + syslog.syslog(syslog.LOG_ERR, traceback.format_exc()) |