bug, hard coded port number for telnet on ipal. Made port dynamic.
[monitor.git] / pcucontrol / models / IPAL.py
index 48394df..8929946 100644 (file)
@@ -17,11 +17,14 @@ class IPAL(PCUControl):
 
                try:
                        # TODO: make sleep backoff, before stopping.
-                       time.sleep(4)
+                       time.sleep(8)
                        ret = s.recv(count, socket.MSG_DONTWAIT)
                except socket.error, e:
                        if e[0] == errno.EAGAIN:
-                               raise Exception(e[1])
+                               #raise Exception(e[1])
+                               raise ExceptionNotFound(e[1])
+                       elif e[0] == errno.ETIMEDOUT:
+                               raise ExceptionTimeout(e[1])
                        else:
                                # TODO: not other exceptions.
                                raise Exception(e)
@@ -46,13 +49,14 @@ class IPAL(PCUControl):
                self.transport.open(self.host)
                ## XXX Some iPals require you to hit Enter a few times first
                self.transport.ifThenSend("Password >", "\r\n\r\n", ExceptionNotFound)
+               self.transport.ifThenSend("Password >", "\r\n\r\n", ExceptionNotFound)
                # Login
                self.transport.ifThenSend("Password >", self.password, ExceptionPassword)
                self.transport.write("\r\n\r\n")
                if not dryrun: # P# - Pulse relay
                        print "node_port %s" % node_port
                        self.transport.ifThenSend("Enter >", 
-                                                       "P7", # % node_port, 
+                                                       "P%s"%node_port, 
                                                        ExceptionNotFound)
                        print "send newlines"
                        self.transport.write("\r\n\r\n")