blob: db344cd1a7c99a49a36f5d02ddcb18bab8715e36 [file] [log] [blame]
Tony Mack3066a952015-01-05 22:48:11 -05001from core.models import Site, SiteDeployment
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
3
Tony Mack3066a952015-01-05 22:48:11 -05004class SiteDeploymentDeleter(Deleter):
5 model='SiteDeployment'
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04006
7 def call(self, pk):
Tony Mack3066a952015-01-05 22:48:11 -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()