X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fserver%2Fsfa-clean-peer-records.py;h=5c133351ddaa793b38912f6fc7138cae3e6559f5;hb=3d7237fa0b5f2b4a60cb97c7fb3b6aecfd94558a;hp=5cf9905ae17c761f5571e1e912ef7042d312472c;hpb=a283bfae0e7f3f60216d4e1e65634ea1fce62e9f;p=sfa.git diff --git a/sfa/server/sfa-clean-peer-records.py b/sfa/server/sfa-clean-peer-records.py index 5cf9905a..5c133351 100644 --- a/sfa/server/sfa-clean-peer-records.py +++ b/sfa/server/sfa-clean-peer-records.py @@ -3,16 +3,15 @@ import sys import os import traceback -from sfa.util.misc import * -from sfa.util.genitable import GeniTable -from sfa.util.geniclient import GeniClient -from sfa.plc.api import GeniAPI +from sfa.util.namespace import * +from sfa.util.table import SfaTable +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 ServerException +from sfa.util.xmlrpcprotocol import xmlrpcprotocol, ServerException import socket def main(): @@ -32,15 +31,15 @@ def main(): # and a valid credential authority = config.SFA_INTERFACE_HRN url = 'http://%s:%s/' %(config.SFA_REGISTRY_HOST, config.SFA_REGISTRY_PORT) - registry = GeniClient(url, key_file, cert_file) - sfa_api = GeniAPI(key_file = key_file, cert_file = cert_file, interface='registry') + registry = xmlrpcprotocol.get_server((url, key_file, cert_file) + sfa_api = SfaAPI(key_file = key_file, cert_file = cert_file, interface='registry') credential = sfa_api.getCredential() # get peer registries registries = Registries(sfa_api) # get local peer records - table = GeniTable() + table = SfaTable() peer_records = table.find({'~peer_authority': None}) for peer_record in peer_records: peer_auth = peer_record['peer_authority'] @@ -48,15 +47,12 @@ def main(): try: peer_record_hrn = peer_record['hrn'] arg_list = [credential, peer_record_hrn] - request_hash = key.compute_hash(arg_list) - records = registries[peer_auth].resolve(credential, peer_record_hrn, request_hash) + records = registries[peer_auth].resolve(credential, peer_record_hrn) except ServerException: # an exception will be thrown if the record doenst exist # if so remove the record from the local registry - arg_list = [credential] - request_hash = key.compute_hash(arg_list) - registries[sfa_api.hrn].remove_peer_object(credential, peer_record, request_hash) + registries[sfa_api.hrn].remove_peer_object(credential, peer_record) except: - traceback.print_exc() + traceback.print_exc() if __name__ == '__main__': main()