- subclass the correct class
[plcapi.git] / PLC / Methods / AdmQueryPowerControlUnit.py
index 25bbc0e..8fc2f42 100644 (file)
@@ -6,7 +6,7 @@ from PLC.Parameter import Parameter, Mixed
 from PLC.PCUs import PCU, PCUs
 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 AdmQueryPowerControlUnit(Method):
     """
@@ -19,7 +19,7 @@ class AdmQueryPowerControlUnit(Method):
     roles = ['admin', 'pi', 'user', 'tech']
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         {'pcu_hostname': PCU.fields['hostname'],
          'pcu_ip': PCU.fields['ip'],
          'node_hostname': Node.fields['hostname'],
@@ -31,7 +31,7 @@ class AdmQueryPowerControlUnit(Method):
     def call(self, auth, search_vals):
         # Get all PCUs. This is a stupid function. The API should not
         # be used for DB mining.
-        pcus = PCUs(self.api).values()
+        pcus = PCUs(self.api)
 
         if 'pcu_hostname' in search_vals:
             pcus = filter(lambda pcu: \
@@ -53,7 +53,7 @@ class AdmQueryPowerControlUnit(Method):
         if 'node_hostname' in search_vals:
             pcus = filter(lambda pcu: \
                           search_vals['node_hostname'] in \
-                          [node['hostname'] for node in Nodes(self.api, pcu['node_ids']).values()],
+                          [node['hostname'] for node in Nodes(self.api, pcu['node_ids'])],
                           pcus)
 
         return [pcu['pcu_id'] for pcu in pcus]