#
# Thierry Parmentelat - INRIA
#
+# $Id: GetPeerData.py 5574 2007-10-25 20:33:17Z thierry $
import time
from PLC.Nodes import Node, Nodes
from PLC.Persons import Person, Persons
from PLC.Slices import Slice, Slices
+from PLC.SliceAttributes import SliceAttributes
class GetPeerData(Method):
"""
node_fields = filter(lambda field: field not in \
['boot_nonce', 'key', 'session', 'root_person_ids'],
Node.fields)
+ nodes = Nodes(self.api, {'peer_id': None}, node_fields);
+ # filter out whitelisted nodes
+ nodes = [ n for n in nodes if not n['slice_ids_whitelist']]
+
person_fields = filter(lambda field: field not in \
['password', 'verification_key', 'verification_expires'],
# XXX Optimize to return only those Persons, Keys, and Slices
# necessary for slice creation on the calling peer's nodes.
+
+ # filter out special person
+ persons = Persons(self.api, {'~email':[self.api.config.PLC_API_MAINTENANCE_USER,
+ self.api.config.PLC_ROOT_USER],
+ 'peer_id': None}, person_fields)
+
+ # filter out system slices
+ system_slice_ids = SliceAttributes(self.api, {'name': 'system', 'value': '1'}).dict('slice_id')
+ slices = Slices(self.api, {'peer_id': None,
+ '~slice_id':system_slice_ids.keys()})
+
result = {
'Sites': Sites(self.api, {'peer_id': None}),
'Keys': Keys(self.api, {'peer_id': None}),
- 'Nodes': Nodes(self.api, {'peer_id': None}, node_fields),
- 'Persons': Persons(self.api, {'peer_id': None}, person_fields),
- 'Slices': Slices(self.api, {'peer_id': None}),
+ 'Nodes': nodes,
+ 'Persons': persons,
+ 'Slices': slices,
}
if isinstance(self.caller, Peer):