From 0ca29fac9af4cd437a8536f28ffd25923ec3f8cd Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 31 May 2012 14:34:09 +0200 Subject: Move install script error handling to a common function All of our install/admin scripts had a try/except block calling the main function and handling common exceptions. These were copy-pasted from each other and modified to various levels of sophistication. This refactors them out of installers to a single function, which includes a final pass/fail message for all of the scripts. Non-install scripts that set up the same log handler levels for stderr and log file are not changed, as it's not possible to log to only the logfile without changing the logger configuration. https://fedorahosted.org/freeipa/ticket/2071 --- ipaserver/install/ldapupdate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipaserver/install/ldapupdate.py') diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py index 61a2ae19..e75ee804 100644 --- a/ipaserver/install/ldapupdate.py +++ b/ipaserver/install/ldapupdate.py @@ -47,9 +47,12 @@ import inspect from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE from ipaserver.install.plugins import FIRST, MIDDLE, LAST -class BadSyntax(Exception): +class BadSyntax(installutils.ScriptError): def __init__(self, value): self.value = value + self.msg = "There is a syntax error in this update file: \n %s" % value + self.rval = 1 + def __str__(self): return repr(self.value) -- cgit