blob: cc71d43d559307b55ec4db259f05b43adfd53d17 [file] [log] [blame]
Sapan Bhatia39e85582014-11-19 15:07:36 -05001from core.models import Site, SiteDeployments
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
3
Sapan Bhatia39e85582014-11-19 15:07:36 -05004class SiteDeploymentsDeleter(Deleter):
5 model='SiteDeployments'
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04006
7 def call(self, pk):
Sapan Bhatia39e85582014-11-19 15:07:36 -05008 site_deployment = SiteDeployments.objects.get(pk=pk)
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04009 if site_deployment.tenant_id:
10 driver = self.driver.admin_driver(deployment=site_deployment.deployment.name)
11 driver.delete_tenant(site_deployment.tenant_id)
12 site_deployment.delete()