X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fregistry_manager.py;h=b49507a05336bc5ed45bc1215715090e3b4d9c13;hb=c69a6abf9d9438c95031debede437213582cd932;hp=bbd958ef49b4d7eab568074ef0cdd2fa53dbfa38;hpb=b54e90d0c3868fa5afb89ff784cba0d5d36265ad;p=sfa.git diff --git a/sfa/managers/registry_manager.py b/sfa/managers/registry_manager.py index bbd958ef..b49507a0 100644 --- a/sfa/managers/registry_manager.py +++ b/sfa/managers/registry_manager.py @@ -40,17 +40,18 @@ class RegistryManager: 'urn':xrn.get_urn(), 'peers':peers}) - def GetCredential(self, api, xrn, type, caller_xrn=None): - dbsession = api.dbsession() + def GetCredential(self, api, xrn, input_type, caller_xrn=None): # convert xrn to hrn - if type: - hrn = urn_to_hrn(xrn)[0] + if input_type: + hrn, _ = urn_to_hrn(xrn) + type = input_type else: hrn, type = urn_to_hrn(xrn) # Slivers don't have credentials but users should be able to # specify a sliver xrn and receive the slice's credential - if type == 'sliver' or '-' in Xrn(hrn).leaf: + # However if input_type is specified + if type == 'sliver' or ( not input_type and '-' in Xrn(hrn).leaf): slice_xrn = api.driver.sliver_to_slice_xrn(hrn) hrn = slice_xrn.hrn @@ -59,7 +60,9 @@ class RegistryManager: if not auth_hrn or hrn == api.config.SFA_INTERFACE_HRN: auth_hrn = hrn auth_info = api.auth.get_auth_info(auth_hrn) + # get record info + dbsession = api.dbsession() record=dbsession.query(RegRecord).filter_by(type=type,hrn=hrn).first() if not record: raise RecordNotFound("hrn=%s, type=%s"%(hrn,type))