Site deployment step, refactored
diff --git a/planetstack/openstack_observer/steps/sync_site_deployments.py b/planetstack/openstack_observer/steps/sync_site_deployments.py
index fa89d2c..a8a00f6 100644
--- a/planetstack/openstack_observer/steps/sync_site_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_site_deployments.py
@@ -7,10 +7,7 @@
class SyncSiteDeployments(OpenStackSyncStep):
requested_interval=0
- provides=[Site, SiteDeployments]
-
- def fetch_pending(self):
- return SiteDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ provides=[SiteDeployments, Site]
def sync_record(self, site_deployment):
if not site_deployment.tenant_id:
@@ -26,3 +23,7 @@
description=site_deployment.site.name,
enabled=site_deployment.site.enabled)
+ def delete_record(self, site_deployment):
+ if site_deployment.tenant_id:
+ driver = self.driver.admin_driver(deployment=site_deployment.deployment.name)
+ driver.delete_tenant(site_deployment.tenant_id)