From c3f62accd9509164351f4895e655412d07f9a42b Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Thu, 10 Jul 2008 18:16:07 +0000 Subject: [PATCH] Completes support for the ePowerSwitch series. Does not support the 8XM, from site 'fem'. --- reboot.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/reboot.py b/reboot.py index 6a3b9bb..7c6bea3 100755 --- a/reboot.py +++ b/reboot.py @@ -8,6 +8,7 @@ import os, sys import xml, xmlrpclib import errno, time, traceback import urllib2 +import urllib import threading, popen2 import array, struct #from socket import * @@ -878,15 +879,23 @@ class ePowerSwitchGood(PCUControl): # failing here means the User/passwd is wrong (hopefully) raise ExceptionPassword("Incorrect username/password") - # TODO: after verifying that the user/password is correct, we should - # actually reboot the given node. - + # NOTE: after verifying that the user/password is correct, + # actually reboot the given node. if not dryrun: - # add data to handler, - # fetch url one more time on cmd.html, econtrol.html or whatever. - pass + try: + data = urllib.urlencode({'P%d' % node_port : "r"}) + req = urllib2.Request(self.url + "cmd.html") + req.add_header("Authorization", authheader) + # add data to handler, + f = urllib2.urlopen(req, data) + if self.verbose: print f.read() + except: + import traceback; traceback.print_exc() - if self.verbose: print f.read() + # fetch url one more time on cmd.html, econtrol.html or whatever. + # pass + else: + if self.verbose: print f.read() self.close() return 0 @@ -1281,6 +1290,8 @@ def reboot_test(nodename, values, continue_probe, verbose, dryrun): if values['pcu_id'] in [1089, 1071, 1046, 1035, 1118]: eps = ePowerSwitchGood(values, verbose, ['80']) elif values['pcu_id'] in [1003]: + # OLD EPOWER + print "OLD EPOWER" eps = ePowerSwitch(values, verbose, ['80']) else: eps = ePowerSwitchGood(values, verbose, ['80']) -- 2.47.0