git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
when GetCredential is called with an explicit type, do not 'guess' that we might...
[sfa.git]
/
sfa
/
managers
/
registry_manager.py
diff --git
a/sfa/managers/registry_manager.py
b/sfa/managers/registry_manager.py
index
bbd958e
..
b49507a
100644
(file)
--- a/
sfa/managers/registry_manager.py
+++ b/
sfa/managers/registry_manager.py
@@
-40,17
+40,18
@@
class RegistryManager:
'urn':xrn.get_urn(),
'peers':peers})
'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
# 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
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
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)
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
# 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))
record=dbsession.query(RegRecord).filter_by(type=type,hrn=hrn).first()
if not record:
raise RecordNotFound("hrn=%s, type=%s"%(hrn,type))