X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FRebootNode.py;h=a6e0439dab7d76cea75cd772087b1ce8f68d2b5c;hb=d20644a48d03667bb25dc583517de06e94606c64;hp=d0bc75b43baa2c236ebde6bb6f41879b130aa50c;hpb=77e4f177dfee85705c36298c3230b2e4a3e73467;p=plcapi.git diff --git a/PLC/Methods/RebootNode.py b/PLC/Methods/RebootNode.py index d0bc75b..a6e0439 100644 --- a/PLC/Methods/RebootNode.py +++ b/PLC/Methods/RebootNode.py @@ -1,4 +1,3 @@ -# $Id$ import socket from PLC.Faults import * @@ -35,7 +34,7 @@ class RebootNode(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") node = nodes[0] @@ -46,11 +45,11 @@ class RebootNode(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 delete nodes from specified site" + raise PLCPermissionDenied("Not allowed to delete nodes from specified site") session = node['session'] if not session: - raise PLCInvalidArgument, "No session key on record for that node (i.e., has never successfully booted)" + raise PLCInvalidArgument("No session key on record for that node (i.e., has never successfully booted)") session = session.strip() # Only use the hostname as a backup, try to use the primary ID @@ -64,11 +63,11 @@ class RebootNode(Method): try: udp_pod(host, session) - except socket.error, e: + except socket.error as e: # Ignore socket errors pass - self.event_objects = {'Node': [node['node_id']]} - self.message = "RebootNode called" - + self.event_objects = {'Node': [node['node_id']]} + self.message = "RebootNode called" + return 1