From 7cef2d7fdf875c96517df6d6cf26b7b371427183 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 28 Mar 2007 14:02:46 +0000 Subject: [PATCH] merge from trunk : filter out special persons and slices --- PLC/Methods/GetPeerData.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/PLC/Methods/GetPeerData.py b/PLC/Methods/GetPeerData.py index 7258384..42aad06 100644 --- a/PLC/Methods/GetPeerData.py +++ b/PLC/Methods/GetPeerData.py @@ -1,6 +1,7 @@ # # Thierry Parmentelat - INRIA # +# $Id: GetPeerData.py,v 1.13 2007/03/28 14:00:27 thierry Exp $ import time @@ -16,6 +17,7 @@ from PLC.Keys import Key, Keys 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): """ @@ -54,12 +56,23 @@ class GetPeerData(Method): # 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}), + 'Persons': persons, + 'Slices': slices, } if isinstance(self.caller, Peer): -- 2.43.0