move key sync logic to sync_slivers
diff --git a/planetstack/observer/steps/sync_slice_deployments.py b/planetstack/observer/steps/sync_slice_deployments.py
index 01a10dd..c7b20ce 100644
--- a/planetstack/observer/steps/sync_slice_deployments.py
+++ b/planetstack/observer/steps/sync_slice_deployments.py
@@ -89,41 +89,6 @@
tenant=tenant.name,
deployment=slice_deployment.deployment.name)
- # create a public key for the slice creator
- if deployment_user.user.public_key:
- keyname = deployment_user.user.email.lower().replace('@', 'AT').replace('.', '') +\
- slice_deployment.slice.name
- slice_deployment.keyname = keyname
- key_fields = {'name': keyname,
- 'public_key': deployment_user.user.public_key}
- client_driver.create_keypair(**key_fields)
-
- # create network
- #network = client_driver.create_network(slice_deployment.slice.name)
- #slice_deployment.network_id = network['id']
-
- # create router
- #router = client_driver.create_router(slice_deployment.slice.name)
- #slice_deployment.router_id = router['id']
-
- # create subnet for slice's private network
- #next_subnet = self.get_next_subnet(deployment=slice_deployment.deployment.name)
- #cidr = str(next_subnet.cidr)
- #ip_version = next_subnet.version
- #start = str(next_subnet[2])
- #end = str(next_subnet[-2])
- #subnet = client_driver.create_subnet(name=slice_deployment.slice.name,
- # network_id = network['id'],
- # cidr_ip = cidr,
- # ip_version = ip_version,
- # start = start,
- # end = end)
- #slice_deployment.subnet_id = subnet['id']
- # add subnet as interface to slice's router
- #client_driver.add_router_interface(router['id'], subnet['id'])
- # add external route
- #client_driver.add_external_route(subnet)
-
if slice_deployment.id and slice_deployment.tenant_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 3759747..473b3ac 100644
--- a/planetstack/observer/steps/sync_slivers.py
+++ b/planetstack/observer/steps/sync_slivers.py
@@ -67,7 +67,15 @@
image_id = image['id']
# look up key name at the deployment
+ # create/fetch keypair
keyname = None
+ if sliver.creator.public_key:
+ keyname = sliver.creator.email.lower().replace('@', 'AT').replace('.', '') +\
+ sliver.slice.name
+ key_fields = {'name': keyname,
+ 'public_key': sliver.creator.public_key}
+ driver.create_keypair(**key_fields)
+
slice_deployments = SliceDeployments.objects.filter(slice = sliver.slice,
deployment = sliver.deploymentNetwork)
for slice_deployment in slice_deployments: