do not update the 'updated' timestamp when updating the 'enacted' timestamp otherwise 'updated' will always be larger than 'enacted'
diff --git a/planetstack/openstack/driver.py b/planetstack/openstack/driver.py
index 530d93b..4c0791e 100644
--- a/planetstack/openstack/driver.py
+++ b/planetstack/openstack/driver.py
@@ -312,9 +312,9 @@
if not security_group:
security_group = self.config.nova_default_security_group
- #authorized_keys = "\n".join(pubkeys)
- #files = {'/root/.ssh/authorized_keys': authorized_keys}
files = {}
+ if pubkeys:
+ files['/root/.ssh/authorized_keys'] = "\n".join(pubkeys)
hints = {}
availability_zone = None
diff --git a/planetstack/openstack/manager.py b/planetstack/openstack/manager.py
index 131b8fb..f912270 100644
--- a/planetstack/openstack/manager.py
+++ b/planetstack/openstack/manager.py
@@ -252,10 +252,13 @@
@require_enabled
def save_sliver(self, sliver):
if not sliver.instance_id:
+ slice_memberships = SliceMembership.objects.filter(slice=sliver.slice)
+ pubkeys = [sm.user.public_key for sm in slice_memberships if sm.user.public_key != null]
instance = self.driver.spawn_instance(name=sliver.name,
key_name = sliver.creator.keyname,
image_id = sliver.image.image_id,
- hostname = sliver.node.name )
+ hostname = sliver.node.name,
+ pubkeys = pubkeys )
sliver.instance_id = instance.id
sliver.instance_name = getattr(instance, 'OS-EXT-SRV-ATTR:instance_name')
diff --git a/planetstack/openstack/observer.py b/planetstack/openstack/observer.py
index 0690558..85c4c2c 100644
--- a/planetstack/openstack/observer.py
+++ b/planetstack/openstack/observer.py
@@ -59,14 +59,14 @@
for site in pending_sites:
self.manager.save_site(site)
site.enacted = datetime.now()
- site.save()
+ site.save(update_fields=['enacted'])
# get all slices that need to be synced (enacted < updated or enacted is None)
pending_slices = Slice.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
for slice in pending_slices:
self.manager.save_slice(slice)
slice.enacted = datetime.now()
- slice.save()
+ slice.save(update_fields=['enacted'])
# get all sites that where enacted != null. We can assume these sites
# have previously been synced and need to be checed for deletion.
@@ -101,9 +101,10 @@
# get all users that need to be synced (enacted < updated or enacted is None)
pending_users = User.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
for user in pending_users:
+ print "syncing user", user
self.manager.save_user(user)
user.enacted = datetime.now()
- user.save()
+ user.save(update_fields=['enacted'])
# get all users that where enacted != null. We can assume these users
# have previously been synced and need to be checed for deletion.
@@ -135,7 +136,7 @@
self.manager.init_caller(sliver.creator)
self.manager.save_sliver(sliver)
sliver.enacted = datetime.now()
- sliver.save()
+ sliver.save(update_fields=['enacted'])
# get all slivers that where enacted != null. We can assume these users
# have previously been synced and need to be checed for deletion.
@@ -150,6 +151,7 @@
for instance in instances:
if instance.id not in sliver_dict:
# lookup tenant and update context
- tenant = self.manager.driver.shell.keystone.tenants.findall(id=instance.tenant_id)
- self.manager.init_admin(tenant=tenant.name)
- self.manager.driver.destroy_instance(instance.id)
+ #tenant = self.manager.driver.shell.keystone.tenants.findall(id=instance.tenant_id)
+ #self.manager.init_admin(tenant=tenant.name)
+ #self.manager.driver.destroy_instance(instance.id)
+ pass