blind 2to3
[plcapi.git] / PLC / Methods / RebootNodeWithPCU.py
index 2a31e2b..ba9f308 100644 (file)
@@ -1,5 +1,3 @@
-# $Id$
-# $URL$
 import socket
 
 from PLC.Faults import *
@@ -44,7 +42,7 @@ class RebootNodeWithPCU(Method):
     # Get account information
         nodes = Nodes(self.api, [node_id_or_hostname])
         if not nodes:
-            raise PLCInvalidArgument, "No such node"
+            raise PLCInvalidArgument("No such node")
 
         if testrun is None:
             testrun = False
@@ -58,24 +56,26 @@ class RebootNodeWithPCU(Method):
         # member of the site at which the node is located.
         if 'admin' not in self.caller['roles']:
             if node['site_id'] not in self.caller['site_ids']:
-                raise PLCPermissionDenied, "Not allowed to reboot nodes from specified site"
+                raise PLCPermissionDenied("Not allowed to reboot nodes from specified site")
 
         # Verify that the node has pcus associated with it.
         pcus = PCUs(self.api, {'pcu_id' : node['pcu_ids']} )
         if not pcus:
-            raise PLCInvalidArgument, "No PCUs associated with Node"
+            raise PLCInvalidArgument("No PCUs associated with Node")
 
         pcu = pcus[0]
 
         if not external_dependency:
-            raise PLCNotImplemented, "Could not load external module to attempt reboot"
+            raise PLCNotImplemented("Could not load external module to attempt reboot")
 
         # model, hostname, port,
         # i = pcu['node_ids'].index(node['node_id'])
         # p = pcu['ports'][i]
         ret = reboot.reboot_api(node, pcu, testrun)
 
+        node.update_last_pcu_reboot(commit=True) # commits new timestamp to node 
+
         self.event_objects = {'Node': [node['node_id']]}
-        self.message = "RebootNodeWithPCU called"
+        self.message = "RebootNodeWithPCU %s with %s returned %s" % (node['node_id'], pcu['pcu_id'], ret)
 
         return ret