from PLC.Parameter import Parameter, Mixed
from PLC.Nodes import Node, Nodes
from PLC.NodeNetworks import NodeNetwork, NodeNetworks
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
from PLC.POD import udp_pod
class RebootNode(Method):
roles = ['admin', 'pi', 'tech']
accepts = [
- PasswordAuth(),
+ Auth(),
Mixed(Node.fields['node_id'],
Node.fields['hostname'])
]
def call(self, auth, node_id_or_hostname):
# Get account information
- nodes = Nodes(self.api, [node_id_or_hostname]).values()
+ nodes = Nodes(self.api, [node_id_or_hostname])
if not nodes:
raise PLCInvalidArgument, "No such node"
# 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']).values()
+ nodenetworks = NodeNetworks(self.api, node['nodenetwork_ids'])
for nodenetwork in nodenetworks:
if nodenetwork['is_primary'] == 1:
host = nodenetwork['ip']
except socket.error, e:
# Ignore socket errors
pass
-
+
+ self.message = "RebootNode called"
+
return 1