move pcucontrol package into pcucontrol module.
[pcucontrol.git] / pcucontrol / models / CustomPCU.py
diff --git a/pcucontrol/models/CustomPCU.py b/pcucontrol/models/CustomPCU.py
new file mode 100644 (file)
index 0000000..60de348
--- /dev/null
@@ -0,0 +1,26 @@
+# Each method follows the following format:
+#    CustomPCU_loginbase()
+# 
+# This provides a simple means of lookup given the custom type.
+#    The only problem might come up if a single site has multiple custom PCUs.
+#    That would be pretty wierd though...
+
+from pcucontrol.reboot import *
+
+class CustomPCU_uniklu(PCUControl):
+       def run_http(self, node_port, dryrun):
+               url = "https://www-itec.uni-klu.ac.at/plab-pcu/index.php" 
+
+               if not dryrun:
+                       # Turn host off, then on
+                       formstr = "plab%s=off" % node_port
+                       os.system("curl --user %s:%s --form '%s' --insecure %s" % (self.username, self.password, formstr, url))
+                       time.sleep(5)
+                       formstr = "plab%s=on" % node_port
+                       os.system("curl --user %s:%s --form '%s' --insecure %s" % (self.username, self.password, formstr, url))
+               else:
+                       os.system("curl --user %s:%s --insecure %s" % (self.username, self.password, url))
+
+
+               
+