return new_cred.save_to_string(save_parents=True)
-def resolve(api, hrns, type=None, origin_hrn):
+def resolve(api, hrns, type=None, origin_hrn=None):
# load all know registry names into a prefix tree and attempt to find
# the longest matching prefix
records.extend([GeniRecord(dict=record).as_dict() for record in peer_records])
# try resolving the remaining unfound records at the local registry
- remaining_hrns = set(hrns).difference([record['hrn'] for record in records])
+ remaining_hrns = set(hrns).difference([record['hrn'] for record in records])
+ remaining_hrns = [hrn for hrn in remaining_hrns]
table = GeniTable()
local_records = table.findObjects({'hrn': remaining_hrns})
for record in local_records:
raise RecordNotFound(str(hrns))
if type:
- records = filter(lambda rec: rec['type'] == type, records)
+ records = filter(lambda rec: rec['type'] in [type], records)
return records
uuid = create_uuid()
pkey = Keypair(create=True)
if 'key' in record and record['key']:
- if isinstance(record['key'], list):
+ if isinstance(record['key'], types.ListType):
pub_key = record['key'][0]
else:
pub_key = record['key']
keys = person['key_ids']
keys = api.plshell.GetKeys(api.plauth, person['key_ids'])
key_exists = False
- if isinstance(new_record['key'], list):
+ if isinstance(new_record['key'], types.ListType):
new_key = new_record['key'][0]
else:
new_key = new_record['key']