+ def nodeaction(self, **data):
+ for item in data.keys():
+ print "%s %s" % ( item, data[item] )
+
+ if 'hostname' in data:
+ hostname = data['hostname']
+ else:
+ flash("No hostname given in submitted data")
+ return
+
+ if 'submit' in data or 'type' in data:
+ try:
+ action = data['submit']
+ except:
+ action = data['type']
+ else:
+ flash("No submit action given in submitted data")
+ return
+
+ if action == "Reboot":
+ print "REBOOT: %s" % hostname
+ ret = reboot.reboot_str(str(hostname))
+ print ret
+ if ret: raise RuntimeError("Error using PCU: " + ret)
+ flash("Reboot appeared to work. All at most 5 minutes. Run ExternalScan to check current status.")
+
+ elif action == "ExternalScan":
+ scanapi.externalprobe(str(hostname))
+ flash("External Scan Successful!")
+ elif action == "InternalScan":
+ scanapi.internalprobe(str(hostname))
+ flash("Internal Scan Successful!")
+ else:
+ # unknown action
+ raise RuntimeError("Unknown action given")
+ return
+
+ # TODO: add form validation