From: Stephen Soltesz <soltesz@cs.princeton.edu>
Date: Fri, 18 Jun 2010 19:51:25 +0000 (+0000)
Subject: add a parameter to RebootNodeWithPCU to perform a 'testrun' without rebooting the... 
X-Git-Tag: PLCAPI-5.0-10~4
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b0f3bc65926002bffd013f8201b6200c9e53db79;p=plcapi.git

add a parameter to RebootNodeWithPCU to perform a 'testrun' without rebooting the node.
---

diff --git a/PLC/Methods/RebootNodeWithPCU.py b/PLC/Methods/RebootNodeWithPCU.py
index fac74d39..ac5b6b65 100644
--- a/PLC/Methods/RebootNodeWithPCU.py
+++ b/PLC/Methods/RebootNodeWithPCU.py
@@ -34,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
@@ -69,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"
diff --git a/PLCAPI.spec b/PLCAPI.spec
index 43e747ec..083a03fb 100644
--- a/PLCAPI.spec
+++ b/PLCAPI.spec
@@ -37,7 +37,7 @@ Requires: mod_python
 Requires: mod_ssl
 Requires: SOAPpy
 # for the RebootNodeWithPCU method
-Requires: pcucontrol
+Requires: pcucontrol >= 1.6
 # for OMF integration
 Requires: pyaspects
 Requires: python-twisted-words