From ebab64974b52073272891fcbc9bd682067f0a25c Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Thu, 12 Mar 2009 19:33:16 +0000 Subject: [PATCH] catch an exception from DRAC logins when the connection is closed early. --- pcucontrol/models/DRAC.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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: -- 2.43.0