from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Nodes import Node, Nodes
-from PLC.NodeNetworks import NodeNetwork, NodeNetworks
+from PLC.Interfaces import Interface, Interfaces
from PLC.Auth import Auth
from PLC.POD import udp_pod
# 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]
# 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
# address instead.
host = node['hostname']
- nodenetworks = NodeNetworks(self.api, node['nodenetwork_ids'])
- for nodenetwork in nodenetworks:
- if nodenetwork['is_primary'] == 1:
- host = nodenetwork['ip']
+ interfaces = Interfaces(self.api, node['interface_ids'])
+ for interface in interfaces:
+ if interface['is_primary'] == 1:
+ host = interface['ip']
break
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"
+
return 1