From: Tony Mack Date: Thu, 16 Feb 2012 19:11:06 +0000 (-0500) Subject: removing unused script X-Git-Tag: sfa-2.1-3~10^2~7 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=41eaebc70b5a17b819a1d6d7f173c63ed5c51ab3 removing unused script --- diff --git a/setup.py b/setup.py index 033a7d4d..8ec10e02 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,6 @@ scripts = glob("sfa/clientbin/*.py") + \ 'sfa/importer/sfa-nuke-plc.py', 'sfa/server/sfa-ca.py', 'sfa/server/sfa-start.py', - 'sfa/server/sfa-clean-peer-records.py', 'sfa/server/sfa_component_setup.py', 'sfatables/sfatables', 'keyconvert/keyconvert.py', diff --git a/sfa/server/sfa-clean-peer-records.py b/sfa/server/sfa-clean-peer-records.py deleted file mode 100644 index a618e506..00000000 --- a/sfa/server/sfa-clean-peer-records.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python - -import sys -import os -import traceback -import socket - -from sfa.util.prefixTree import prefixTree -from sfa.util.config import Config - -from sfa.trust.certificate import Keypair -from sfa.trust.hierarchy import Hierarchy -from sfa.server.registry import Registries - -from sfa.storage.table import SfaTable - -from sfa.client.sfaserverproxy import SfaServerProxy - -from sfa.generic import Generic - -def main(): - config = Config() - if not config.SFA_REGISTRY_ENABLED: - sys.exit(0) - - # Get the path to the sfa server key/cert files from - # the sfa hierarchy object - sfa_hierarchy = Hierarchy() - auth_info = sfa_hierarchy.get_interface_auth_info() - key_file = auth_info.get_privkey_filename() - cert_file = auth_info.get_gid_filename() - key = Keypair(filename=key_file) - - # get a connection to our local sfa registry - # and a valid credential - authority = config.SFA_INTERFACE_HRN - url = 'http://%s:%s/' %(config.SFA_REGISTRY_HOST, config.SFA_REGISTRY_PORT) - registry = SfaServerProxy(url, key_file, cert_file) - sfa_api = Generic.the_flavour() - credential = sfa_api.getCredential() - - # get peer registries - registries = Registries(sfa_api) - tree = prefixTree() - tree.load(registries.keys()) - - # get local peer records - table = SfaTable() - peer_records = table.find({'~peer_authority': None}) - found_records = [] - hrn_dict = {} - for record in peer_records: - registry_hrn = tree.best_match(record['hrn']) - if registry_hrn not in hrn_dict: - hrn_dict[registry_hrn] = [] - hrn_dict[registry_hrn].append(record['hrn']) - - # attempt to resolve the record at the authoritative interface - for registry_hrn in hrn_dict: - if registry_hrn in registries: - records = [] - target_hrns = hrn_dict[registry_hrn] - try: - 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(peer_record['hrn'], credential, peer_record['type']) - -if __name__ == '__main__': - main()