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):
"""
roles = ['admin', 'pi', 'user', 'tech']
accepts = [
- PasswordAuth(),
+ Auth(),
{'pcu_hostname': PCU.fields['hostname'],
'pcu_ip': PCU.fields['ip'],
'node_hostname': Node.fields['hostname'],
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: \
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]