# when running GetCredential
# This is to reflect the 'enabled' user field in planetlab testbeds
# expected retcod boolean
- def is_enabled_entity (self, record) :
+ def is_enabled (self, record) :
return True
-
+
+ # the following is used in Resolve (registry) when run in full mode
+ # after looking up the sfa db, we wish to be able to display
+ # testbed-specific info as well
+ # this at minima should fill in the 'researcher' field for slice records
+ def augment_records_with_testbed_info (self, sfa_records):
+ return sfa_records
+
# incoming record, as provided by the client to the Register API call
# expected retcod 'pointer'
# 'pointer' is typically an int db id, that makes sense in the testbed environment
# verify_cancreate_credential requires that the member lists
# (researchers, pis, etc) be filled in
- if not self.driver.is_enabled_entity (record):
+ if not self.driver.is_enabled (record):
raise AccountNotEnabled(": PlanetLab account %s is not enabled. Please contact your site PI" %(record['email']))
# get the callers gid
if full:
# in full mode we get as much info as we can, which involves contacting the
# testbed for getting implementation details about the record
- self.driver.fill_record_info(local_records)
+ self.driver.augment_records_with_testbed_info(local_records)
# also we fill the 'url' field for known authorities
# used to be in the driver code, sounds like a poorman thing though
def solve_neighbour_url (record):
rspec_type == 'eucalyptus' or rspec_type == 'max')
########## disabled users
- def is_enabled_entity (self, record):
- self.fill_record_info(record)
+ def is_enabled (self, record):
+ self.fill_record_info(record, deep=False)
if record['type'] == 'user':
return record['enabled']
# only users can be disabled
return True
+ def augment_records_with_testbed_info (self, sfa_records):
+ return self.fill_record_info (sfa_records, deep=True)
+
##########
def register (self, sfa_record, hrn, pub_key):
type = sfa_record['type']
return pl_record
####################
- def fill_record_info(self, records):
+ def fill_record_info(self, records, deep=False):
"""
Given a (list of) SFA record, fill in the PLC specific
and SFA specific fields in the record.
records = [records]
self.fill_record_pl_info(records)
- self.fill_record_sfa_info(records)
+ if deep:
+ self.fill_record_hrns(records)
+ self.fill_record_sfa_info(records)
+ return records
def fill_record_pl_info(self, records):
"""
pubkeys = [keys[key_id]['key'] for key_id in record['key_ids'] if key_id in keys]
record['keys'] = pubkeys
- # fill in record hrns
- records = self.fill_record_hrns(records)
-
return records
def fill_record_hrns(self, records):