- # add new records
- for hrn in hrns_expected:
- if hrn not in hrns_found:
- record = {
- 'hrn': hrn,
- 'type': 'sa',
- }
- table.insert(record)
-
-
- def get_connections(self, registries):
- """
- read connection details for the trusted peer registries from file return
- a dictionary of connections keyed on interface hrn.
- """
- connections = {}
- required_fields = self.default_fields.keys()
- if not isinstance(registries, []):
- registries = [registries]
- for registry in registries:
- # make sure the required fields are present and not null
- for key in required_fields
- if not registry.get(key):
- continue
- hrn, address, port = registry['hrn'], registry['addr'], registry['port']
- url = 'http://%(address)s:%(port)s' % locals()
- # check which client we should use
- # sfa.util.xmlrpcprotocol is default
- client_type = 'xmlrpcprotocol'
- if registry.has_key('client') and \
- registry['client'] in ['geniclientlight'] and \
- GeniClientLight:
- client_type = 'geniclientlight'
- connections[hrn] = GeniClientLight(url, self.api.key_file, self.api.cert_file)
- else:
- connections[hrn] = xmlrpcprotocol.get_server(url, self.api.key_file, self.api.cert_file)