Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/observer/steps/sync_roles.py b/planetstack/observer/steps/sync_roles.py
index 18a784a..5dc30d9 100644
--- a/planetstack/observer/steps/sync_roles.py
+++ b/planetstack/observer/steps/sync_roles.py
@@ -29,12 +29,9 @@
def sync_record(self, role):
- save_role = False
- if not role.krole_id:
- krole = self.driver.create_role(role.role)
- role.krole_id = krole.id
- save_role = True
-
- if (save_role):
- role.save()
-
+ if not role.enacted:
+ deployments = Deployment.objects.all()
+ for deployment in deployments:
+ driver = self.driver.admin_driver(deployment=deployment.name)
+ driver.create_role(role.role)
+ role.save()
diff --git a/planetstack/observer/steps/sync_slice_memberships.py b/planetstack/observer/steps/sync_slice_memberships.py
index 6a4f75f..b6b1638 100644
--- a/planetstack/observer/steps/sync_slice_memberships.py
+++ b/planetstack/observer/steps/sync_slice_memberships.py
@@ -19,7 +19,8 @@
for slice_deployment in slice_deployments:
if not slice_deployment.tenant_id:
continue
- user_deployments = UserDeployments.objects.filter(deployment=slice_deployment.deployment)
+ user_deployments = UserDeployments.objects.filter(deployment=slice_deployment.deployment,
+ user=slice_memb.user)
if user_deployments:
kuser_id = user_deployments[0].kuser_id
driver = self.driver.admin_driver(deployment=slice_deployment.deployment.name)
diff --git a/planetstack/observer/steps/sync_slivers.py b/planetstack/observer/steps/sync_slivers.py
index 299d079..9780dcb 100644
--- a/planetstack/observer/steps/sync_slivers.py
+++ b/planetstack/observer/steps/sync_slivers.py
@@ -34,7 +34,8 @@
pubkeys = [sm.user.public_key for sm in slice_memberships if sm.user.public_key]
if sliver.creator.public_key:
pubkeys.append(sliver.creator.public_key)
-
+ if sliver.slice.creator.public_key:
+ pubkeys.append(sliver.slice.creator.public_key)
# netowrks
#nics = self.get_requested_networks(sliver.slice, sliver.node.deployment)
nics = []
@@ -76,8 +77,8 @@
nics = nics )
sliver.instance_id = instance.id
sliver.instance_name = getattr(instance, 'OS-EXT-SRV-ATTR:instance_name')
+ sliver.save()
if sliver.instance_id and metadata_update:
driver.update_instance_metadata(sliver.instance_id, metadata_update)
- sliver.save()
diff --git a/planetstack/openstack/driver.py b/planetstack/openstack/driver.py
index 5b8e728..b8faf25 100644
--- a/planetstack/openstack/driver.py
+++ b/planetstack/openstack/driver.py
@@ -48,10 +48,12 @@
def create_role(self, name):
roles = self.shell.keystone.roles.findall(name=name)
- if not roles:
+ roles_title = self.shell.keystone.roles.findall(name=name.title())
+ roles_found = roles + roles_title
+ if not roles_found:
role = self.shell.keystone.roles.create(name)
else:
- role = roles[0]
+ role = roles_found[0]
return role
def delete_role(self, filter):