From: Stephen Soltesz Date: Thu, 20 Aug 2009 20:26:22 +0000 (+0000) Subject: Catch and raise the exception when GetSession Fails. X-Git-Tag: BootManager-4.3-11~2 X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=commitdiff_plain;h=fedd02d122a4e365b3c02059b55440b6c1a27f03 Catch and raise the exception when GetSession Fails. Then start sshd and stop BootManager immediately so that only one message goes to the user --- diff --git a/source/BootAPI.py b/source/BootAPI.py index d69755b..6d16967 100644 --- a/source/BootAPI.py +++ b/source/BootAPI.py @@ -79,8 +79,8 @@ def create_auth_structure( vars, call_params ): auth = auth_session except Exception, e: - print e - pass + # NOTE: BM has failed to authenticate utterly. + raise BootManagerAuthenticationException, "%s" % e return auth diff --git a/source/BootManager.py b/source/BootManager.py index 40f7b56..370044f 100755 --- a/source/BootManager.py +++ b/source/BootManager.py @@ -293,6 +293,12 @@ class BootManager: self.LOG.write( "\n\nKeyError while running: %s\n" % str(e) ) except BootManagerException, e: self.LOG.write( "\n\nException while running: %s\n" % str(e) ) + except BootManagerAuthenticationException, e: + self.LOG.write( "\n\nFailed to Authenticate Node: %s\n" % str(e) ) + # sets /tmp/CANCEL_BOOT flag + StartDebug.Run(self.VARS, self.LOG ) + # Return immediately b/c any other calls to API will fail + return success except: self.LOG.write( "\n\nImplementation Error\n") traceback.print_exc(file=self.LOG.OutputFile) diff --git a/source/Exceptions.py b/source/Exceptions.py index 9fa5301..be4587e 100644 --- a/source/Exceptions.py +++ b/source/Exceptions.py @@ -13,3 +13,9 @@ class BootManagerException(Exception): def __str__( self ): return self.__fault +class BootManagerAuthenticationException(Exception): + def __init__( self, err ): + self.__fault= err + + def __str__( self ): + return self.__fault