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
fix bug in get_rspec when trying to get the rspec for a slice that doesnt exist
[sfa.git]
/
geni
/
aggregate.py
diff --git
a/geni/aggregate.py
b/geni/aggregate.py
index
cf538a1
..
4b9f8a3
100644
(file)
--- a/
geni/aggregate.py
+++ b/
geni/aggregate.py
@@
-263,8
+263,12
@@
class Aggregate(GeniServer):
elif type in ['slice']:
slicename = hrn_to_pl_slicename(hrn)
slices = self.shell.GetSlices(self.auth, [slicename])
elif type in ['slice']:
slicename = hrn_to_pl_slicename(hrn)
slices = self.shell.GetSlices(self.auth, [slicename])
- node_ids = slices[0]['node_ids']
- nodes = self.shell.GetNodes(self.auth, node_ids)
+ if not slices:
+ nodes = []
+ else:
+ slice = slices[0]
+ node_ids = slice['node_ids']
+ nodes = self.shell.GetNodes(self.auth, node_ids)
# Filter out whitelisted nodes
public_nodes = lambda n: n.has_key('slice_ids_whitelist') and not n['slice_ids_whitelist']
# Filter out whitelisted nodes
public_nodes = lambda n: n.has_key('slice_ids_whitelist') and not n['slice_ids_whitelist']
@@
-373,7
+377,11
@@
class Aggregate(GeniServer):
sites = self.shell.GetSites(self.auth, [login_base])
if not sites:
authority = get_authority(slice_hrn)
sites = self.shell.GetSites(self.auth, [login_base])
if not sites:
authority = get_authority(slice_hrn)
- site_record = self.registry.resolve(self.credential, authority)
+ site_records = self.registry.resolve(self.credential, authority)
+ site_record = {}
+ if not site_records:
+ raise RecordNotFound(authority)
+ site_record = site_records[0]
site_info = site_record.as_dict()
site = site_info['pl_info']
site_info = site_record.as_dict()
site = site_info['pl_info']
@@
-383,7
+391,7
@@
class Aggregate(GeniServer):
else:
site = sites[0]
else:
site = sites[0]
- self.shell.AddSlice(self.auth, slice
_info
)
+ self.shell.AddSlice(self.auth, slice)
# get the list of valid slice users from the registry and make
# they are added to the slice
# get the list of valid slice users from the registry and make
# they are added to the slice
@@
-403,11
+411,21
@@
class Aggregate(GeniServer):
# Create the person record
if not persons:
self.shell.AddPerson(self.auth, person_dict)
# Create the person record
if not persons:
self.shell.AddPerson(self.auth, person_dict)
+ key_ids = []
+ else:
+ key_ids = persons[0]['key_ids']
+
self.shell.AddPersonToSlice(self.auth, person_dict['email'], slicename)
self.shell.AddPersonToSlice(self.auth, person_dict['email'], slicename)
- # Add this person's public keys
+
+ # Get this users local keys
+ keylist = self.shell.GetKeys(self.auth, key_ids, ['key'])
+ keys = [key['key'] for key in keylist]
+
+ # add keys that arent already there
for personkey in person_dict['keys']:
for personkey in person_dict['keys']:
- key = {'key_type': 'ssh', 'key': personkey}
- self.shell.AddPersonKey(self.auth, person_dict['email'], key)
+ if personkey not in keys:
+ key = {'key_type': 'ssh', 'key': personkey}
+ self.shell.AddPersonKey(self.auth, person_dict['email'], key)
# find out where this slice is currently running
nodelist = self.shell.GetNodes(self.auth, slice['node_ids'], ['hostname'])
# find out where this slice is currently running
nodelist = self.shell.GetNodes(self.auth, slice['node_ids'], ['hostname'])