- added logging variable 'object_type'
[plcapi.git] / PLC / Methods / AdmQueryNode.py
index 8297f24..4c0a032 100644 (file)
@@ -5,7 +5,7 @@ from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Nodes import Node, Nodes
 from PLC.NodeNetworks import NodeNetwork, NodeNetworks, valid_ip
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
 
 class AdmQueryNode(Method):
     """
@@ -15,10 +15,12 @@ class AdmQueryNode(Method):
 
     status = "deprecated"
 
+    object_type = 'Node'
+
     roles = ['admin', 'pi', 'user', 'tech']
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         {'node_hostname': Node.fields['hostname'],
          'nodenetwork_ip': NodeNetwork.fields['ip'],
          'nodenetwork_mac': NodeNetwork.fields['mac'],
@@ -30,7 +32,7 @@ class AdmQueryNode(Method):
     def call(self, auth, search_vals):
         # Get possible nodenetworks
         if 'node_hostname' in search_vals:
-            nodes = Nodes(self.api, [search_vals['node_hostname']]).values()
+            nodes = Nodes(self.api, [search_vals['node_hostname']])
             if not nodes:
                 return []
 
@@ -41,11 +43,11 @@ class AdmQueryNode(Method):
                 return [nodes[0]['node_id']]
 
             if nodes[0]['nodenetwork_ids']:
-                nodenetworks = NodeNetworks(self.api, nodes[0]['nodenetwork_ids']).values()
+                nodenetworks = NodeNetworks(self.api, nodes[0]['nodenetwork_ids'])
             else:
                 nodenetworks = []
         else:
-            nodenetworks = NodeNetworks(self.api).values()
+            nodenetworks = NodeNetworks(self.api)
 
         if 'nodenetwork_ip' in search_vals:
             if not valid_ip(search_vals['nodenetwork_ip']):