From: Stephen Soltesz Date: Thu, 12 Mar 2009 19:33:16 +0000 (+0000) Subject: catch an exception from DRAC logins when the connection is closed early. X-Git-Tag: Monitor-2.0-4~2 X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=commitdiff_plain;h=ebab64974b52073272891fcbc9bd682067f0a25c catch an exception from DRAC logins when the connection is closed early. --- diff --git a/pcucontrol/models/DRAC.py b/pcucontrol/models/DRAC.py index a64a87d..e3172b6 100644 --- a/pcucontrol/models/DRAC.py +++ b/pcucontrol/models/DRAC.py @@ -12,10 +12,13 @@ class DRAC(PCUControl): "-o PasswordAuthentication=yes "+\ "-o PubkeyAuthentication=no" s = pxssh.pxssh() - if not s.login(self.host, self.username, self.password, ssh_options, + try: + if not s.login(self.host, self.username, self.password, ssh_options, original_prompts="Dell", login_timeout=Transport.TELNET_TIMEOUT): - raise ExceptionPassword("Invalid Password") - + raise ExceptionPassword("Invalid Password") + except pexpect.EOF: + raise ExceptionPrompt("Disconnect before login prompt") + print "logging in... %s" % self.host s.send("\r\n\r\n") try: