fix more bugs
diff --git a/planetstack/observer/steps/sync_site_deployments.py b/planetstack/observer/steps/sync_site_deployments.py
index a996c85..fa89d2c 100644
--- a/planetstack/observer/steps/sync_site_deployments.py
+++ b/planetstack/observer/steps/sync_site_deployments.py
@@ -21,7 +21,7 @@
site_deployment.tenant_id = tenant.id
site_deployment.save()
elif site_deployment.site.id and site_deployment.tenant_id:
- driver = self.driver.admin_driver(deployment=site_deployment.name)
+ driver = self.driver.admin_driver(deployment=site_deployment.deployment.name)
driver.update_tenant(site_deployment.tenant_id,
description=site_deployment.site.name,
enabled=site_deployment.site.enabled)
diff --git a/planetstack/openstack/driver.py b/planetstack/openstack/driver.py
index 9183daf..c3e1f35 100644
--- a/planetstack/openstack/driver.py
+++ b/planetstack/openstack/driver.py
@@ -24,23 +24,30 @@
self.enabled = manager_enabled
self.has_openstack = has_openstack
+ self.deployment = None
+ self.admin_user = None
def client_driver(self, caller=None, tenant=None, deployment=None):
+ admin_driver = self.admin_driver(tenant=tenant, deployment=deployment)
if caller:
auth = {'username': caller.email,
'password': hashlib.md5(caller.password).hexdigest()[:6],
'tenant': tenant}
- client = OpenStackClient(deployment=deployment, **auth)
+ client = OpenStackClient(deployment=admin_driver.deployment, **auth)
else:
- client = OpenStackClient(tenant=tenant, deployment=deployment)
+ client = OpenStackClient(tenant=tenant, deployment=admin_driver.deployment)
driver = OpenStackDriver(client=client)
+ driver.admin_user = admin_driver.admin_user
+ driver.deployment = admin_driver.deployment
return driver
def admin_driver(self, tenant=None, deployment=None):
deployment = Deployment.objects.get(name=deployment)
client = OpenStackClient(tenant=tenant, deployment=deployment)
driver = OpenStackDriver(client=client)
+ driver.admin_user = client.keystone.users.find(name=deployment.admin_user)
+ driver.deployment = deployment
return driver
def create_role(self, name):