X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fserver%2Fsfa-clean-peer-records.py;h=f821f4ce04696adeff0e1ba5a75bf1f689e5d5dc;hb=dbce495b6f2e7d8dccbfb18c5507907d784c143b;hp=18e13e32a1563876b42e64924452dfebd292577e;hpb=676d81c2d87c50aff2674abf76b778af2dd10260;p=sfa.git diff --git a/sfa/server/sfa-clean-peer-records.py b/sfa/server/sfa-clean-peer-records.py index 18e13e32..f821f4ce 100644 --- a/sfa/server/sfa-clean-peer-records.py +++ b/sfa/server/sfa-clean-peer-records.py @@ -3,16 +3,14 @@ import sys import os import traceback -from sfa.util.namespace import * from sfa.util.table import SfaTable from sfa.util.prefixTree import prefixTree from sfa.plc.api import SfaAPI from sfa.util.config import Config from sfa.trust.certificate import Keypair from sfa.trust.hierarchy import Hierarchy -from sfa.util.report import trace, error from sfa.server.registry import Registries -from sfa.util.xmlrpcprotocol import * +import sfa.util.xmlrpcprotocol as xmlrpcprotocol import socket def main(): @@ -58,15 +56,22 @@ def main(): records = [] target_hrns = hrn_dict[registry_hrn] try: - records = registries[registry_hrn].resolve(credential, target_hrns) + records = registries[registry_hrn].Resolve(target_hrns, credential) found_records.extend([record['hrn'] for record in records]) + except ServerException: + # an exception will be thrown if the record doenst exist + # if so remove the record from the local registry + continue except: + # this deosnt necessarily mean the records dont exist + # lets give them the benefit of the doubt here (for now) + found_records.extend(target_hrns) traceback.print_exc() # remove what wasnt found for peer_record in peer_records: if peer_record['hrn'] not in found_records: - registries[sfa_api.hrn].remove(credential, peer_record) + registries[sfa_api.hrn].Remove(peer_record['hrn'], credential, peer_record['type']) if __name__ == '__main__': main()