blob: db344cd1a7c99a49a36f5d02ddcb18bab8715e36 [file] [log] [blame]
Sapan Bhatia6d21da32014-11-11 21:41:12 -05001from core.models import Site, SiteDeployment
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
3
4class SiteDeploymentDeleter(Deleter):
Sapan Bhatia6d21da32014-11-11 21:41:12 -05005 model='SiteDeployment'
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04006
7 def call(self, pk):
Sapan Bhatia6d21da32014-11-11 21:41:12 -05008 site_deployment = SiteDeployment.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()