1 from geni.util.faults import *
2 from geni.util.excep import *
3 from geni.util.method import Method
4 from geni.util.parameter import Parameter, Mixed
5 from geni.util.auth import Auth
6 from geni.util.record import GeniRecord
7 from geni.util.debug import log
13 @param cred credential string authorizing the caller
14 @param hrn human readable name to resolve
15 @return a list of record dictionaries or empty list
18 interfaces = ['registry']
21 Parameter(str, "Credential string"),
22 Parameter(str, "Human readable name (hrn)")
25 returns = [GeniRecord]
27 def call(self, cred, hrn):
29 self.api.auth.check(cred, 'resolve')
31 # is this a foreign record
32 if not hrn.startswith(self.api.hrn):
33 for registry in self.api.registries:
34 if hrn.startswith(registry):
35 records = self.api.registries[registry].resolve(self.api.credential, name)
36 good_records = records
38 auth_hrn = self.api.auth.get_authority(hrn)
41 table = self.api.auth.get_auth_table(auth_hrn)
42 records = table.resolve('*', hrn)
44 for record in records:
46 self.api.fill_record_info(record)
47 good_records.append(record)
48 except PlanetLabRecordDoesNotExist:
49 # silently drop the ones that are missing in PL
50 print >> log, "ignoring geni record ", record.get_name(), \
51 " because pl record does not exist"
54 dicts = [record.as_dict() for record in good_records]
56 raise RecordNotFound(hrn)