move pcucontrol package into pcucontrol module.
[pcucontrol.git] / pcucontrol / models / CustomPCU.py
1 # Each method follows the following format:
2 #    CustomPCU_loginbase()
3
4 # This provides a simple means of lookup given the custom type.
5 #    The only problem might come up if a single site has multiple custom PCUs.
6 #    That would be pretty wierd though...
7
8 from pcucontrol.reboot import *
9
10 class CustomPCU_uniklu(PCUControl):
11         def run_http(self, node_port, dryrun):
12                 url = "https://www-itec.uni-klu.ac.at/plab-pcu/index.php" 
13
14                 if not dryrun:
15                         # Turn host off, then on
16                         formstr = "plab%s=off" % node_port
17                         os.system("curl --user %s:%s --form '%s' --insecure %s" % (self.username, self.password, formstr, url))
18                         time.sleep(5)
19                         formstr = "plab%s=on" % node_port
20                         os.system("curl --user %s:%s --form '%s' --insecure %s" % (self.username, self.password, formstr, url))
21                 else:
22                         os.system("curl --user %s:%s --insecure %s" % (self.username, self.password, url))
23
24
25                 
26