X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=sfa%2Fmethods%2Fresolve.py;h=602e5a11477f81f592699f8ebaf11cca71003fe4;hb=c6165173f3a94ea8c20a3f432951deffcf86e580;hp=65582b585670b9913dd653b0c9407121005e9d2b;hpb=1e7a431c7c95fef3c133fb0fbac40c65726a6b4f;p=sfa.git diff --git a/sfa/methods/resolve.py b/sfa/methods/resolve.py index 65582b58..602e5a11 100644 --- a/sfa/methods/resolve.py +++ b/sfa/methods/resolve.py @@ -25,13 +25,16 @@ class resolve(Method): accepts = [ Parameter(str, "Credential string"), - Parameter(str, "Human readable name (hrn)") + Parameter(str, "Human readable name (hrn)"), + Mixed(Parameter(str, "Request hash"), + Parameter(None, "Request hash not specified")) ] returns = [GeniRecord] - def call(self, cred, hrn, caller_cred=None): + def call(self, cred, hrn, request_hash=None, caller_cred=None): + self.api.auth.authenticateCred(cred, [cred, hrn], request_hash) self.api.auth.check(cred, 'resolve') if caller_cred==None: caller_cred=cred @@ -57,12 +60,17 @@ class resolve(Method): if registry_hrn != self.api.hrn: credential = self.api.getCredential() try: - records = registries[registry_hrn].resolve(credential, hrn, caller_cred=caller_cred) - good_records = [record.as_dict() for record in records] - if good_records: - return good_records + request_hash=None + records = registries[registry_hrn].resolve(credential, hrn, request_hash, caller_cred) + good_records = [GeniRecord(dict=record).as_dict() for record in records] except: - traceback.print_exc() + arg_list = [credential, hrn] + request_hash=self.api.key.compute_hash(arg_list) + records = registries[registry_hrn].resolve(credential, hrn, request_hash, caller_cred) + good_records = [GeniRecord(dict=record).as_dict() for record in records] + + if good_records: + return good_records # if we still havnt found the record yet, try the local registry table = GeniTable()