choices=('text', 'xml', 'simple'), help='display record in different formats')
def show(self, xrn, type=None, format=None, outfile=None):
"""Display details for a registered object"""
- records = self.api.manager.Resolve(self.api, xrn, type, True)
+ records = self.api.manager.Resolve(self.api, xrn, type, details=True)
for record in records:
sfa_record = Record(dict=record)
sfa_record.dump(format)
self.print_help()
sys.exit(1)
hrn = args[0]
+ # xxx should set details=True here but that's not in the xmlrpc interface ...
+ # record_dicts = self.registry().Resolve(hrn, self.my_credential_string, details=True)
record_dicts = self.registry().Resolve(hrn, self.my_credential_string)
record_dicts = filter_records(options.type, record_dicts)
if not record_dicts:
# the following is used in Resolve (registry) when run in full mode
# after looking up the sfa db, we wish to be able to display
# testbed-specific info as well
- # this at minima should fill in the 'researcher' field for slice records
- # as this information is then used to compute rights
- # roadmap: there is an intention to redesign the SFA database so as to clear up
- # this constraint, based on the principle that SFA should not rely on the
- # testbed database to perform such a core operation (i.e. getting rights right)
+ # based on the principle that SFA should not rely on the testbed database
+ # to perform such a core operation (i.e. getting rights right)
+ # this is no longer in use when performing other SFA operations
def augment_records_with_testbed_info (self, sfa_records):
return sfa_records
return new_cred.save_to_string(save_parents=True)
- def Resolve(self, api, xrns, type=None, full=True):
+ # the default for full, which means 'dig into the testbed as well', should be false
+ def Resolve(self, api, xrns, type=None, details=False):
if not isinstance(xrns, types.ListType):
# try to infer type if not set and we get a single input
credential = api.getCredential()
interface = api.registries[registry_hrn]
server_proxy = api.server_proxy(interface, credential)
+ # should propagate the details flag but that's not supported in the xmlrpc interface yet
+ #peer_records = server_proxy.Resolve(xrns, credential,type, details=details)
peer_records = server_proxy.Resolve(xrns, credential,type)
# pass foreign records as-is
# previous code used to read
if type:
local_records = local_records.filter_by(type=type)
local_records=local_records.all()
- logger.info("Resolve: local_records=%s (type=%s)"%(local_records,type))
+ logger.info("Resolve details=%s: local_records=%s (type=%s)"%(details,local_records,type))
local_dicts = [ record.__dict__ for record in local_records ]
- if full:
- # in full mode we get as much info as we can, which involves contacting the
+ if details:
+ # in details mode we get as much info as we can, which involves contacting the
# testbed for getting implementation details about the record
self.driver.augment_records_with_testbed_info(local_dicts)
# also we fill the 'url' field for known authorities
origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
# resolve the record
- records = self.api.manager.Resolve(self.api, xrns, full = False)
+ records = self.api.manager.Resolve(self.api, xrns, details = False)
if not records:
raise RecordNotFound(xrns)
# another registry if needed
# I wonder if this is truly the intention, or shouldn't we instead
# only look in the local db ?
- records = self.api.manager.Resolve(self.api, xrn, type)
+ records = self.api.manager.Resolve(self.api, xrn, type, details=False)
if not records:
raise RecordNotFound(hrn)
interfaces = ['registry']
+ # should we not accept an optional 'details' argument ?
accepts = [
Mixed(Parameter(str, "Human readable name (hrn or urn)"),
Parameter(list, "List of Human readable names ([hrn])")),
returns = [Parameter(dict, "registry record")]
def call(self, xrns, creds):
+ # xxx should be ar arg
+ details=False
type = None
if not isinstance(xrns, types.ListType):
type = Xrn(xrns).get_type()
self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrns, self.name))
# send the call to the right manager
- return self.api.manager.Resolve(self.api, xrns, type)
+ return self.api.manager.Resolve(self.api, xrns, type, details=details)