remove unnecessary debug messages
authorStephen Soltesz <soltesz@cs.princeton.edu>
Sun, 11 Dec 2011 12:08:44 +0000 (12:08 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Sun, 11 Dec 2011 12:08:44 +0000 (12:08 +0000)
pcucontrol/models/APCControl.py
pcucontrol/models/BayTech.py
pcucontrol/models/BlackBoxPSMaverick.py
pcucontrol/models/IPAL.py
pcucontrol/models/IntelAMT.py
pcucontrol/models/ePowerSwitch.py
pcucontrol/reboot.py
pcucontrol/transports/ssh/pxssh.py

index 52dfe18..801ff4d 100644 (file)
@@ -6,12 +6,12 @@ class APCControl(BasicPCUControl):
 #    reboot_sequence = []
 
     def run(self, node_port, dryrun):
 #    reboot_sequence = []
 
     def run(self, node_port, dryrun):
-        print "RUNNING!!!!!!!!!!!!"
+        #print "RUNNING!!!!!!!!!!!!"
         if self.transport.type == Transport.HTTPS or self.type == Transport.HTTP:
         if self.transport.type == Transport.HTTPS or self.type == Transport.HTTP:
-            print "APC via http...."
+            #print "APC via http...."
             return self.run_http_or_https(node_port, dryrun)
         else:
             return self.run_http_or_https(node_port, dryrun)
         else:
-            print "APC via telnet/ssh...."
+            #print "APC via telnet/ssh...."
             return self.run_telnet_or_ssh(node_port, dryrun)
 
     def pcu_run(self, node_port, dryrun=False):
             return self.run_telnet_or_ssh(node_port, dryrun)
 
     def pcu_run(self, node_port, dryrun=False):
@@ -59,7 +59,7 @@ class APCControl(BasicPCUControl):
                 raise ExceptionNoTransport("Unsupported transport for http command")
 
         cmd = cmd % ( self.username, self.password, self.host)
                 raise ExceptionNoTransport("Unsupported transport for http command")
 
         cmd = cmd % ( self.username, self.password, self.host)
-        print "CMD: %s" % cmd
+        #print "CMD: %s" % cmd
 
         p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
 
 
         p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
 
@@ -69,12 +69,12 @@ class APCControl(BasicPCUControl):
             return 0
         else:
             # NOTE: an error has occurred, so no need to log out.
             return 0
         else:
             # NOTE: an error has occurred, so no need to log out.
-            print "RESULT: ", result
+            #print "RESULT: ", result
             return result
 
     def get_https_cmd(self):
         version = self.get_version()
             return result
 
     def get_https_cmd(self):
         version = self.get_version()
-        print "VERSION: %s" % version
+        #print "VERSION: %s" % version
         if "AP96" in version:
             cmd = "curl -s --insecure --user '%s:%s' https://%s/outlets.htm " + \
                   " | grep -E '^[^<]+' " + \
         if "AP96" in version:
             cmd = "curl -s --insecure --user '%s:%s' https://%s/outlets.htm " + \
                   " | grep -E '^[^<]+' " + \
@@ -89,14 +89,14 @@ class APCControl(BasicPCUControl):
     
     def get_http_cmd(self):
         version = self.get_version()
     
     def get_http_cmd(self):
         version = self.get_version()
-        print "VERSION: %s" % version
+        #print "VERSION: %s" % version
         if "AP7900" in version:
             cmd = "curl -s --anyauth --user '%s:%s' http://%s/rPDUout.htm | grep -E '^[^<]+'" 
         elif "AP7920" in version:
             cmd = "curl -s --anyauth --user '%s:%s' http://%s/ms3out.htm | grep -E '^[^<]+' " 
         else:
             # default case...
         if "AP7900" in version:
             cmd = "curl -s --anyauth --user '%s:%s' http://%s/rPDUout.htm | grep -E '^[^<]+'" 
         elif "AP7920" in version:
             cmd = "curl -s --anyauth --user '%s:%s' http://%s/ms3out.htm | grep -E '^[^<]+' " 
         else:
             # default case...
-            print "USING DEFAULT"
+            #print "USING DEFAULT"
             cmd = "curl -s --anyauth --user '%s:%s' http://%s/ms3out.htm | grep -E '^[^<]+' " 
             
         return cmd
             cmd = "curl -s --anyauth --user '%s:%s' http://%s/ms3out.htm | grep -E '^[^<]+' " 
             
         return cmd
@@ -143,7 +143,7 @@ class APCControl(BasicPCUControl):
 
         cmd = cmd % ( self.username, self.password, self.host)
         p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
 
         cmd = cmd % ( self.username, self.password, self.host)
         p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
-        print p.read()
+        #print p.read()
 
 class APCControl12p3(APCControl):
     def run_telnet_or_ssh(self, node_port, dryrun):
 
 class APCControl12p3(APCControl):
     def run_telnet_or_ssh(self, node_port, dryrun):
@@ -157,7 +157,7 @@ class APCControl1p4(APCControl):
 
 class APCControl121p3(APCControl):
     def run_telnet_or_ssh(self, node_port, dryrun):
 
 class APCControl121p3(APCControl):
     def run_telnet_or_ssh(self, node_port, dryrun):
-        print "TEST! "
+        #print "TEST! "
         self.reboot_sequence = ["1", "2", "1", str(node_port), "3"]
         return super(APCControl121p3, self).run_telnet_or_ssh(node_port, dryrun)
 
         self.reboot_sequence = ["1", "2", "1", str(node_port), "3"]
         return super(APCControl121p3, self).run_telnet_or_ssh(node_port, dryrun)
 
index fecabd6..81f12bc 100644 (file)
@@ -77,7 +77,7 @@ class BayTechCtrlCUnibe(PCUControl):
        """
        supported_ports = [22]
        def run_ssh(self, node_port, dryrun):
        """
        supported_ports = [22]
        def run_ssh(self, node_port, dryrun):
-               print "BayTechCtrlC %s" % self.host
+               #print "BayTechCtrlC %s" % self.host
 
                ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no"
                s = pxssh.pxssh()
 
                ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no"
                s = pxssh.pxssh()
@@ -86,7 +86,7 @@ class BayTechCtrlCUnibe(PCUControl):
                # Otherwise, the login succeeded.
 
                # Send a ctrl-c to the remote process.
                # Otherwise, the login succeeded.
 
                # Send a ctrl-c to the remote process.
-               print "sending ctrl-c"
+               #print "sending ctrl-c"
                s.send(chr(3))
 
                # Control Outlets  (5 ,1).........5
                s.send(chr(3))
 
                # Control Outlets  (5 ,1).........5
@@ -95,7 +95,7 @@ class BayTechCtrlCUnibe(PCUControl):
                        index = s.expect(["Enter Request :"])
 
                        if index == 0:
                        index = s.expect(["Enter Request :"])
 
                        if index == 0:
-                               print "3"
+                               #print "3"
                                s.send("3\r\n")
                                time.sleep(5)
                                index = s.expect(["DS-RPC>", "Enter user name:"])
                                s.send("3\r\n")
                                time.sleep(5)
                                index = s.expect(["DS-RPC>", "Enter user name:"])
@@ -105,7 +105,7 @@ class BayTechCtrlCUnibe(PCUControl):
                                        index = s.expect(["DS-RPC>"])
 
                                if index == 0:
                                        index = s.expect(["DS-RPC>"])
 
                                if index == 0:
-                                       print "Reboot %d" % node_port
+                                       #print "Reboot %d" % node_port
                                        time.sleep(5)
                                        s.send("Reboot %d\r\n" % node_port)
 
                                        time.sleep(5)
                                        s.send("Reboot %d\r\n" % node_port)
 
@@ -113,10 +113,10 @@ class BayTechCtrlCUnibe(PCUControl):
                                        index = s.expect(["\(Y/N\)\?", "Port in use", "DS-RPC>"])
                                        if index == 0:
                                                if dryrun:
                                        index = s.expect(["\(Y/N\)\?", "Port in use", "DS-RPC>"])
                                        if index == 0:
                                                if dryrun:
-                                                       print "sending N"
+                                                       #print "sending N"
                                                        s.send("N\r\n")
                                                else:
                                                        s.send("N\r\n")
                                                else:
-                                                       print "sending Y"
+                                                       #print "sending Y"
                                                        s.send("Y\r\n")
                                        elif index == 1:
                                                raise ExceptionPrompt("PCU Reported 'Port in use.'")
                                                        s.send("Y\r\n")
                                        elif index == 1:
                                                raise ExceptionPrompt("PCU Reported 'Port in use.'")
@@ -144,7 +144,7 @@ class BayTechCtrlC(PCUControl):
        """
        supported_ports = [22]
        def run_ssh(self, node_port, dryrun):
        """
        supported_ports = [22]
        def run_ssh(self, node_port, dryrun):
-               print "BayTechCtrlC %s" % self.host
+               #print "BayTechCtrlC %s" % self.host
 
                ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no"
                s = pxssh.pxssh()
 
                ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no"
                s = pxssh.pxssh()
@@ -158,40 +158,40 @@ class BayTechCtrlC(PCUControl):
                # Otherwise, the login succeeded.
 
                # Send a ctrl-c to the remote process.
                # Otherwise, the login succeeded.
 
                # Send a ctrl-c to the remote process.
-               print "SENDING ctrl-c"
+               #print "SENDING ctrl-c"
                s.send(chr(3))
 
                # Control Outlets  (5 ,1).........5
                try:
                s.send(chr(3))
 
                # Control Outlets  (5 ,1).........5
                try:
-                       print "EXPECTING: ", "Enter Request :"
+                       #print "EXPECTING: ", "Enter Request :"
                        index = s.expect(["Enter Request :"])
 
                        if index == 0:
                        index = s.expect(["Enter Request :"])
 
                        if index == 0:
-                               print "SENDING: 5"
+                               #print "SENDING: 5"
                                s.send("5\r\n")
                                s.send("5\r\n")
-                               print "EXPECTING: ", "DS-RPC>"
+                               #print "EXPECTING: ", "DS-RPC>"
                                index = s.expect(["DS-RPC>", "Enter user name:", "Port in use."])
                                if index == 1:
                                index = s.expect(["DS-RPC>", "Enter user name:", "Port in use."])
                                if index == 1:
-                                       print "sending username"
+                                       #print "sending username"
                                        s.send(self.username + "\r\n")
                                        index = s.expect(["DS-RPC>"])
                                elif index == 2:
                                        raise ExceptionPrompt("PCU Reported 'Port in use.'")
 
                                if index == 0:
                                        s.send(self.username + "\r\n")
                                        index = s.expect(["DS-RPC>"])
                                elif index == 2:
                                        raise ExceptionPrompt("PCU Reported 'Port in use.'")
 
                                if index == 0:
-                                       print "SENDING: Reboot %d" % node_port
+                                       #print "SENDING: Reboot %d" % node_port
                                        s.send("Reboot %d\r\n" % node_port)
 
                                        s.send("Reboot %d\r\n" % node_port)
 
-                                       print "SLEEPING: 5"
+                                       #print "SLEEPING: 5"
                                        time.sleep(5)
                                        time.sleep(5)
-                                       print "EXPECTING: ", "Y/N?"
+                                       #print "EXPECTING: ", "Y/N?"
                                        index = s.expect(["\(Y/N\)\?", "Port in use", "DS-RPC>"])
                                        if index == 0:
                                                if dryrun:
                                        index = s.expect(["\(Y/N\)\?", "Port in use", "DS-RPC>"])
                                        if index == 0:
                                                if dryrun:
-                                                       print "sending N"
+                                                       #print "sending N"
                                                        s.send("N\r\n")
                                                else:
                                                        s.send("N\r\n")
                                                else:
-                                                       print "SENDING: Y"
+                                                       #print "SENDING: Y"
                                                        s.send("Y\r\n")
                                        elif index == 1:
                                                raise ExceptionPrompt("PCU Reported 'Port in use.'")
                                                        s.send("Y\r\n")
                                        elif index == 1:
                                                raise ExceptionPrompt("PCU Reported 'Port in use.'")
@@ -201,11 +201,11 @@ class BayTechCtrlC(PCUControl):
                                # NOTE: for some reason, the script times out with the
                                # following line.  In manual tests, it works correctly, but
                                # with automated tests, evidently it fails.
                                # NOTE: for some reason, the script times out with the
                                # following line.  In manual tests, it works correctly, but
                                # with automated tests, evidently it fails.
-                               print "SLEEPING: 5"
+                               #print "SLEEPING: 5"
                                time.sleep(5)
                                #print "TOTAL--", s.allstr, "--EOT"
                                index = s.expect(["DS-RPC>"])
                                time.sleep(5)
                                #print "TOTAL--", s.allstr, "--EOT"
                                index = s.expect(["DS-RPC>"])
-                               print "got prompt back"
+                               #print "got prompt back"
 
                        s.close()
 
 
                        s.close()
 
@@ -225,7 +225,7 @@ class BayTech5CtrlC(PCUControl):
        """
        supported_ports = [22]
        def run_ssh(self, node_port, dryrun):
        """
        supported_ports = [22]
        def run_ssh(self, node_port, dryrun):
-               print "BayTech5CtrlC %s" % self.host
+               #print "BayTech5CtrlC %s" % self.host
 
                ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no"
                s = pxssh.pxssh()
 
                ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no"
                s = pxssh.pxssh()
@@ -239,43 +239,43 @@ class BayTech5CtrlC(PCUControl):
                # Otherwise, the login succeeded.
                # Control Outlets  (5 ,1).........5
                try:
                # Otherwise, the login succeeded.
                # Control Outlets  (5 ,1).........5
                try:
-                       print "EXPECTING: ", "Enter Request :"
+                       #print "EXPECTING: ", "Enter Request :"
                        s.send("\r\n")
                        time.sleep(2)
                        index = s.expect(["Enter Request"])
 
                        if index == 0:
                        s.send("\r\n")
                        time.sleep(2)
                        index = s.expect(["Enter Request"])
 
                        if index == 0:
-                               print "SENDING: 5"
+                               #print "SENDING: 5"
                                s.send("5\r\n")
                                s.send("5\r\n")
-                               print "EXPECTING: ", "DS-RPC>"
+                               #print "EXPECTING: ", "DS-RPC>"
                                time.sleep(3)
                                # Send a ctrl-c to the remote process.
                                time.sleep(3)
                                # Send a ctrl-c to the remote process.
-                               #print "SENDING ctrl-c"
+                               ##print "SENDING ctrl-c"
                                #s.send(chr(3))
 
                                index = s.expect(["DS-RPC>", "Enter user name:", "Port in use."])
                                if index == 1:
                                #s.send(chr(3))
 
                                index = s.expect(["DS-RPC>", "Enter user name:", "Port in use."])
                                if index == 1:
-                                       print "sending username"
+                                       #print "sending username"
                                        s.send(self.username + "\r\n")
                                        index = s.expect(["DS-RPC>"])
                                elif index == 2:
                                        raise ExceptionPrompt("PCU Reported 'Port in use.'")
 
                                if index == 0:
                                        s.send(self.username + "\r\n")
                                        index = s.expect(["DS-RPC>"])
                                elif index == 2:
                                        raise ExceptionPrompt("PCU Reported 'Port in use.'")
 
                                if index == 0:
-                                       print "SENDING: Reboot %d" % node_port
+                                       #print "SENDING: Reboot %d" % node_port
                                        #s.send("Reboot %d\r\n" % node_port)
                                        s.send("Reboot %d\r" % node_port)
 
                                        #s.send("Reboot %d\r\n" % node_port)
                                        s.send("Reboot %d\r" % node_port)
 
-                                       print "SLEEPING: 5"
+                                       #print "SLEEPING: 5"
                                        time.sleep(5)
                                        time.sleep(5)
-                                       print "EXPECTING: ", "Y/N?"
+                                       #print "EXPECTING: ", "Y/N?"
                                        index = s.expect(["\(Y/N\)\?", "Port in use", "DS-RPC>"])
                                        if index == 0:
                                                if dryrun:
                                        index = s.expect(["\(Y/N\)\?", "Port in use", "DS-RPC>"])
                                        if index == 0:
                                                if dryrun:
-                                                       print "sending N"
+                                                       #print "sending N"
                                                        s.send("N\r\n")
                                                else:
                                                        s.send("N\r\n")
                                                else:
-                                                       print "SENDING: Y"
+                                                       #print "SENDING: Y"
                                                        s.send("Y\r\n")
                                        elif index == 1:
                                                raise ExceptionPrompt("PCU Reported 'Port in use.'")
                                                        s.send("Y\r\n")
                                        elif index == 1:
                                                raise ExceptionPrompt("PCU Reported 'Port in use.'")
@@ -285,11 +285,11 @@ class BayTech5CtrlC(PCUControl):
                                # NOTE: for some reason, the script times out with the
                                # following line.  In manual tests, it works correctly, but
                                # with automated tests, evidently it fails.
                                # NOTE: for some reason, the script times out with the
                                # following line.  In manual tests, it works correctly, but
                                # with automated tests, evidently it fails.
-                               print "SLEEPING: 5"
+                               #print "SLEEPING: 5"
                                time.sleep(5)
                                #print "TOTAL--", s.allstr, "--EOT"
                                index = s.expect(["DS-RPC>"])
                                time.sleep(5)
                                #print "TOTAL--", s.allstr, "--EOT"
                                index = s.expect(["DS-RPC>"])
-                               print "got prompt back"
+                               #print "got prompt back"
 
                        s.close()
 
 
                        s.close()
 
@@ -319,7 +319,7 @@ class BayTech(PCUControl):
                except ExceptionNotFound, msg:
                        # one machine is configured to ask for a username,
                        # even after login...
                except ExceptionNotFound, msg:
                        # one machine is configured to ask for a username,
                        # even after login...
-                       print "msg: %s" % msg
+                       #print "msg: %s" % msg
                        self.transport.write(self.username + "\r\n")
                        time.sleep(5)
                        self.transport.ifThenSend("DS-RPC>", "Reboot %d" % node_port)
                        self.transport.write(self.username + "\r\n")
                        time.sleep(5)
                        self.transport.ifThenSend("DS-RPC>", "Reboot %d" % node_port)
index ee414dc..9f00b9a 100644 (file)
@@ -25,7 +25,7 @@ class BlackBoxPSMaverick(PCUControl):
 
                p = os.popen(cmd)
                result = p.read()
 
                p = os.popen(cmd)
                result = p.read()
-               print "RESULT: ", result
+               #print "RESULT: ", result
 
                if len(result.split()) > 3:
                        return 0
 
                if len(result.split()) > 3:
                        return 0
index 8929946..d050b75 100644 (file)
@@ -54,17 +54,17 @@ class IPAL(PCUControl):
                self.transport.ifThenSend("Password >", self.password, ExceptionPassword)
                self.transport.write("\r\n\r\n")
                if not dryrun: # P# - Pulse relay
                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
+                       #print "node_port %s" % node_port
                        self.transport.ifThenSend("Enter >", 
                                                        "P%s"%node_port, 
                                                        ExceptionNotFound)
                        self.transport.ifThenSend("Enter >", 
                                                        "P%s"%node_port, 
                                                        ExceptionNotFound)
-                       print "send newlines"
+                       #print "send newlines"
                        self.transport.write("\r\n\r\n")
                        self.transport.write("\r\n\r\n")
-                       print "after new lines"
+                       #print "after new lines"
                # Get the next prompt
                # Get the next prompt
-               print "wait for enter"
+               #print "wait for enter"
                self.transport.ifElse("Enter >", ExceptionTimeout)
                self.transport.ifElse("Enter >", ExceptionTimeout)
-               print "closing "
+               #print "closing "
                self.transport.close()
                return 0
 
                self.transport.close()
                return 0
 
@@ -73,10 +73,10 @@ class IPAL(PCUControl):
 
                power_on = False
 
 
                power_on = False
 
-               print "open socket"
+               #print "open socket"
                s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                try:
                s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                try:
-                       print "connect"
+                       #print "connect"
                        s.connect((self.host, 9100))
                except socket.error, e:
                        s.close()
                        s.connect((self.host, 9100))
                except socket.error, e:
                        s.close()
@@ -90,10 +90,10 @@ class IPAL(PCUControl):
                                raise Exception(e)
                                
                # get current status
                                raise Exception(e)
                                
                # get current status
-               print "Checking status"
+               #print "Checking status"
                s.send(self.format_msg("", 'O'))
                ret = self.recv_noblock(s, 8)
                s.send(self.format_msg("", 'O'))
                ret = self.recv_noblock(s, 8)
-               print "Current status is '%s'" % ret
+               #print "Current status is '%s'" % ret
 
                if ret == '':
                        raise Exception("Status returned 'another session already open' on %s %s : %s" % (self.host, node_port, ret))
 
                if ret == '':
                        raise Exception("Status returned 'another session already open' on %s %s : %s" % (self.host, node_port, ret))
@@ -116,17 +116,17 @@ class IPAL(PCUControl):
 
                if not dryrun:
                        if power_on:
 
                if not dryrun:
                        if power_on:
-                               print "Pulsing %s" % node_port
+                               #print "Pulsing %s" % node_port
                                s.send(self.format_msg("%s" % node_port, 'P'))
                        else:
                                # NOTE: turn power on ; do not pulse the port.
                                s.send(self.format_msg("%s" % node_port, 'P'))
                        else:
                                # NOTE: turn power on ; do not pulse the port.
-                               print "Power was off, so turning on ..."
+                               #print "Power was off, so turning on ..."
                                s.send(self.format_msg("%s" % node_port, 'E'))
                                #s.send(self.format_msg("%s" % node_port, 'P'))
 
                                s.send(self.format_msg("%s" % node_port, 'E'))
                                #s.send(self.format_msg("%s" % node_port, 'P'))
 
-                       print "Receiving response."
+                       #print "Receiving response."
                        ret = self.recv_noblock(s, 8)
                        ret = self.recv_noblock(s, 8)
-                       print "Current status is '%s'" % ret
+                       #print "Current status is '%s'" % ret
 
                        if node_port < len(ret):
                                status = ret[node_port]
 
                        if node_port < len(ret):
                                status = ret[node_port]
index 61e820d..d27bf60 100644 (file)
@@ -17,5 +17,5 @@ class IntelAMT(PCUControl):
                else:
                        cmd_str += " -A http://%s:16992/RemoteControlService -user admin -pass '%s' " % (self.host, self.password )
                        
                else:
                        cmd_str += " -A http://%s:16992/RemoteControlService -user admin -pass '%s' " % (self.host, self.password )
                        
-               print cmd_str
+               #print cmd_str
                return cmd.system(cmd_str, Transport.TELNET_TIMEOUT)
                return cmd.system(cmd_str, Transport.TELNET_TIMEOUT)
index 35b7253..8350197 100644 (file)
@@ -22,11 +22,11 @@ class ePowerSwitchNew(PCUControl):
                        # NOTE: this is expected to fail initially
                        pass
                else:
                        # NOTE: this is expected to fail initially
                        pass
                else:
-                       print self.url
-                       print "-----------"
-                       print handle.read()
-                       print "-----------"
-                       return "ERROR: not protected by HTTP authentication"
+                       #print self.url
+                       #print "-----------"
+                       r = handle.read()
+                       #print "-----------"
+                       return "ERROR: not protected by HTTP authentication: %s" % r
 
                if not hasattr(e, 'code') or e.code != 401:
                        return "ERROR: failed for: %s" % str(e)
 
                if not hasattr(e, 'code') or e.code != 401:
                        return "ERROR: failed for: %s" % str(e)
@@ -71,8 +71,8 @@ class ePowerSwitchOld(PCUControl):
                 authinfo = { "pwd" : self.password }
                 data = urllib.urlencode(authinfo)
                 req = urllib2.Request(self.url + "/elogin.html", data)
                 authinfo = { "pwd" : self.password }
                 data = urllib.urlencode(authinfo)
                 req = urllib2.Request(self.url + "/elogin.html", data)
-                print self.url
-                print data
+                #print self.url
+                #print data
                 response = urllib2.urlopen(req)
                 reply = response.read()
 
                 response = urllib2.urlopen(req)
                 reply = response.read()
 
index 83c96d1..f273348 100755 (executable)
@@ -310,7 +310,7 @@ class PCUControl(PCUModel,PCURecord):
             if port_list == []:
                 raise ExceptionPort("No Open Port: No transport from open ports")
 
             if port_list == []:
                 raise ExceptionPort("No Open Port: No transport from open ports")
 
-        print port_list
+        #print port_list
 
         ret = "No implementation for open ports on selected PCU model"
         for port in port_list:
 
         ret = "No implementation for open ports on selected PCU model"
         for port in port_list:
@@ -320,9 +320,9 @@ class PCUControl(PCUModel,PCURecord):
             type = Transport.porttypemap[port]
             self.transport = Transport(type, verbose)
 
             type = Transport.porttypemap[port]
             self.transport = Transport(type, verbose)
 
-            print "checking for run_%s" % type
+            #print "checking for run_%s" % type
             if hasattr(self, "run_%s" % type):
             if hasattr(self, "run_%s" % type):
-                print "found run_%s" % type
+                #print "found run_%s" % type
                 fxn = getattr(self, "run_%s" % type)
                 ret = self.catcherror(fxn, node_port, dryrun)
                 if ret == 0: # NOTE: success!, so stop
                 fxn = getattr(self, "run_%s" % type)
                 ret = self.catcherror(fxn, node_port, dryrun)
                 if ret == 0: # NOTE: success!, so stop
@@ -357,7 +357,7 @@ class BasicPCUControl(PCUModel):
         PCUModel.__init__(self, plc_pcu_record)
 
     def run_expect_script(self, scriptname, **args):
         PCUModel.__init__(self, plc_pcu_record)
 
     def run_expect_script(self, scriptname, **args):
-        print "Running EXPECT: %s" % scriptname
+        #print "Running EXPECT: %s" % scriptname
         locfg = command.CMD()
 
         if 'ip' in args:
         locfg = command.CMD()
 
         if 'ip' in args:
@@ -365,7 +365,7 @@ class BasicPCUControl(PCUModel):
         else:
             host = self.host
 
         else:
             host = self.host
 
-        print args
+        #print args
         if 'sequence' in args:
             seq = " ".join(args['sequence'])
             seq = "'%s'" % seq
         if 'sequence' in args:
             seq = " ".join(args['sequence'])
             seq = "'%s'" % seq
@@ -376,7 +376,7 @@ class BasicPCUControl(PCUModel):
         cmd = cmd_str + "%s %s %s '%s' %s %s %s"  % (
                     scriptname, host, self.username, 
                     self.password, args['dryrun'], args['model'], seq)
         cmd = cmd_str + "%s %s %s '%s' %s %s %s"  % (
                     scriptname, host, self.username, 
                     self.password, args['dryrun'], args['model'], seq)
-        print cmd
+        #print cmd
         cmd_out, cmd_err = locfg.run_noexcept("expect " + cmd)
         return cmd_out.strip() + cmd_err.strip()
 
         cmd_out, cmd_err = locfg.run_noexcept("expect " + cmd)
         return cmd_out.strip() + cmd_err.strip()
 
@@ -390,7 +390,7 @@ class BasicPCUControl(PCUModel):
         if not hasattr(self, looking_for_fxn):
             raise Exception("This model (%s) does not implement %s" % (self.model, looking_for_fxn))
 
         if not hasattr(self, looking_for_fxn):
             raise Exception("This model (%s) does not implement %s" % (self.model, looking_for_fxn))
 
-        print "found function %s in model %s" % (looking_for_fxn, self.model)
+        #print "found function %s in model %s" % (looking_for_fxn, self.model)
         reboot_fxn = getattr(self, looking_for_fxn)
         ret = self.catcherror(reboot_fxn, node_port, dryrun)
 
         reboot_fxn = getattr(self, looking_for_fxn)
         ret = self.catcherror(reboot_fxn, node_port, dryrun)
 
index c73079b..7cf3310 100644 (file)
@@ -51,7 +51,7 @@ class pxssh (spawn):
         more unique. If that still fails then we return False.
         """
         cmd = "ssh %s -l %s %s" % (ssh_options, username, server)
         more unique. If that still fails then we return False.
         """
         cmd = "ssh %s -l %s %s" % (ssh_options, username, server)
-        print cmd
+        #print cmd
         spawn.__init__(self, cmd, timeout=login_timeout)
         #, "(?i)no route to host"])
         i = self.expect(["(?i)are you sure you want to continue connecting", original_prompts, "(?i)password", "(?i)permission denied", "(?i)terminal type", TIMEOUT, "(?i)connection closed by remote host"])
         spawn.__init__(self, cmd, timeout=login_timeout)
         #, "(?i)no route to host"])
         i = self.expect(["(?i)are you sure you want to continue connecting", original_prompts, "(?i)password", "(?i)permission denied", "(?i)terminal type", TIMEOUT, "(?i)connection closed by remote host"])