From c69a6abf9d9438c95031debede437213582cd932 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 1 Apr 2014 10:19:32 +0200 Subject: [PATCH] when GetCredential is called with an explicit type, do not 'guess' that we might be dealing with a sliver based on hrn leaf --- sfa/managers/registry_manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sfa/managers/registry_manager.py b/sfa/managers/registry_manager.py index 350d969f..b49507a0 100644 --- a/sfa/managers/registry_manager.py +++ b/sfa/managers/registry_manager.py @@ -40,16 +40,18 @@ class RegistryManager: 'urn':xrn.get_urn(), 'peers':peers}) - def GetCredential(self, api, xrn, type, caller_xrn=None): + 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 -- 2.43.0