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
Merge Master in geni-v3 conflict resolution
[sfa.git]
/
sfa
/
methods
/
Resolve.py
diff --git
a/sfa/methods/Resolve.py
b/sfa/methods/Resolve.py
index
d8a536e
..
f3a6e67
100644
(file)
--- a/
sfa/methods/Resolve.py
+++ b/
sfa/methods/Resolve.py
@@
-1,13
+1,11
@@
-### $Id: resolve.py 17157 2010-02-21 04:19:34Z tmack $
-### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/resolve.py $
-import traceback
import types
import types
-from sfa.util.faults import *
-from sfa.util.
namespace import
urn_to_hrn
+
+from sfa.util.
xrn import Xrn,
urn_to_hrn
from sfa.util.method import Method
from sfa.util.method import Method
-from sfa.util.parameter import Parameter, Mixed
+
from sfa.trust.credential import Credential
from sfa.trust.credential import Credential
-from sfa.util.record import SfaRecord
+
+from sfa.storage.parameter import Parameter, Mixed
class Resolve(Method):
"""
class Resolve(Method):
"""
@@
-20,20
+18,28
@@
class Resolve(Method):
interfaces = ['registry']
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"),
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={}):
+ # 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, types.ListType):
+ type = Xrn(xrns).get_type()
xrns=[xrns]
hrns = [urn_to_hrn(xrn)[0] for xrn in xrns]
xrns=[xrns]
hrns = [urn_to_hrn(xrn)[0] for xrn in xrns]
-
#find valid credentials
valid_creds = self.api.auth.checkCredentials(creds, 'resolve')
#find valid credentials
valid_creds = self.api.auth.checkCredentials(creds, 'resolve')
@@
-42,8
+48,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
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)
-
-
+ return self.api.manager.Resolve(self.api, xrns, type, details=details)