add a parameter to RebootNodeWithPCU to perform a 'testrun' without rebooting the...
[plcapi.git] / PLC / Methods / RebootNodeWithPCU.py
index a9e20f5..ac5b6b6 100644 (file)
@@ -1,4 +1,5 @@
 # $Id$
+# $URL$
 import socket
 
 from PLC.Faults import *
@@ -33,17 +34,21 @@ class RebootNodeWithPCU(Method):
     accepts = [
         Auth(),
         Mixed(Node.fields['node_id'],
-              Node.fields['hostname'])
+              Node.fields['hostname']),
+        Parameter(bool, "Run as a test, or as a real reboot", nullok = True)
         ]
 
     returns = Parameter(int, '1 if successful')
 
-    def call(self, auth, node_id_or_hostname):
+    def call(self, auth, node_id_or_hostname, testrun=None):
         # Get account information
         nodes = Nodes(self.api, [node_id_or_hostname])
         if not nodes:
             raise PLCInvalidArgument, "No such node"
 
+        if testrun is None:
+            testrun = False
+
         node = nodes[0]
 
         # Authenticated function
@@ -68,7 +73,7 @@ class RebootNodeWithPCU(Method):
        # model, hostname, port, 
        # i = pcu['node_ids'].index(node['node_id'])
        # p = pcu['ports'][i]
-       ret = reboot.reboot_api(node, pcu)
+       ret = reboot.reboot_api(node, pcu, testrun)
 
         self.event_objects = {'Node': [node['node_id']]}
         self.message = "RebootNodeWithPCU called"