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
list is a function in registry, hence using types.ListType
[sfa.git]
/
sfa
/
managers
/
registry_manager_pl.py
diff --git
a/sfa/managers/registry_manager_pl.py
b/sfa/managers/registry_manager_pl.py
index
5c70ee7
..
f08e18d
100644
(file)
--- a/
sfa/managers/registry_manager_pl.py
+++ b/
sfa/managers/registry_manager_pl.py
@@
-59,7
+59,7
@@
def get_credential(api, hrn, type, is_self=False):
return new_cred.save_to_string(save_parents=True)
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
# load all know registry names into a prefix tree and attempt to find
# the longest matching prefix
@@
-95,7
+95,8
@@
def resolve(api, hrns, type=None, origin_hrn):
records.extend([GeniRecord(dict=record).as_dict() for record in peer_records])
# try resolving the remaining unfound records at the local registry
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:
table = GeniTable()
local_records = table.findObjects({'hrn': remaining_hrns})
for record in local_records:
@@
-112,7
+113,7
@@
def resolve(api, hrns, type=None, origin_hrn):
raise RecordNotFound(str(hrns))
if type:
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
return records
@@
-175,7
+176,7
@@
def register(api, record):
uuid = create_uuid()
pkey = Keypair(create=True)
if 'key' in record and record['key']:
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']
pub_key = record['key'][0]
else:
pub_key = record['key']
@@
-309,7
+310,7
@@
def update(api, record_dict):
keys = person['key_ids']
keys = api.plshell.GetKeys(api.plauth, person['key_ids'])
key_exists = False
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']
new_key = new_record['key'][0]
else:
new_key = new_record['key']