catch an exception from DRAC logins when the connection is closed early.
authorStephen Soltesz <soltesz@cs.princeton.edu>
Thu, 12 Mar 2009 19:33:16 +0000 (19:33 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Thu, 12 Mar 2009 19:33:16 +0000 (19:33 +0000)
pcucontrol/models/DRAC.py

index a64a87d..e3172b6 100644 (file)
@@ -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: