1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Nodes import Node, Nodes
5 from PLC.Auth import Auth
7 class GetNodes(Method):
9 Return an array of structs containing details about nodes. If
10 node_id_or_hostname_list is specified, only the specified nodes
13 Some fields may only be viewed by admins.
16 roles = ['admin', 'pi', 'user', 'tech']
20 [Mixed(Node.fields['node_id'],
21 Node.fields['hostname'])],
24 returns = [Node.fields]
26 def call(self, auth, node_id_or_hostname_list = None):
27 # Get node information
28 nodes = Nodes(self.api, node_id_or_hostname_list).values()
30 # Remove admin only fields
31 if 'admin' not in self.caller['roles']:
33 for field in ['boot_nonce', 'key', 'session', 'root_person_ids']: