X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FResolve.py;h=fc12df1b4b7867ccd89117afe4e9e9fb1e6a8e72;hb=30d9951e075d93127c3909dcb41be09b420b3525;hp=74972cc91ed9e7783e72822d5007d5e0463df3aa;hpb=e39e728991b762ae0b52b52b06655f0c7f1b7421;p=sfa.git diff --git a/sfa/methods/Resolve.py b/sfa/methods/Resolve.py index 74972cc9..fc12df1b 100644 --- a/sfa/methods/Resolve.py +++ b/sfa/methods/Resolve.py @@ -1,10 +1,9 @@ -import types - from sfa.util.xrn import Xrn, urn_to_hrn from sfa.util.method import Method -from sfa.util.parameter import Parameter, Mixed + from sfa.trust.credential import Credential -from sfa.util.record import SfaRecord + +from sfa.storage.parameter import Parameter, Mixed class Resolve(Method): """ @@ -17,18 +16,26 @@ class Resolve(Method): 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])")), Mixed(Parameter(str, "Credential string"), - Parameter(list, "List of credentials)")) + Parameter(list, "List of credentials)")), + Parameter(dict, "options"), ] - returns = [SfaRecord] + # xxx used to be [SfaRecord] + returns = [Parameter(dict, "registry record")] - def call(self, xrns, creds): + def call(self, xrns, creds, options=None): + if options is None: options={} + # use details=False by default, only when explicitly specified do we want + # to mess with the testbed details + if 'details' in options: details=options['details'] + else: details=False type = None - if not isinstance(xrns, types.ListType): + if not isinstance(xrns, list): type = Xrn(xrns).get_type() xrns=[xrns] hrns = [urn_to_hrn(xrn)[0] for xrn in xrns] @@ -40,6 +47,5 @@ class Resolve(Method): 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 - manager = self.api.get_interface_manager() - return manager.resolve(self.api, xrns, type) + return self.api.manager.Resolve(self.api, xrns, type, details=details)