Tony Mack | bdb188a | 2014-04-01 20:24:47 -0400 | [diff] [blame] | 1 | from core.models import Sliver, SliceDeployments |
Tony Mack | 387a73f | 2013-09-18 07:59:14 -0400 | [diff] [blame] | 2 | from observer.deleter import Deleter |
| 3 | |
| 4 | class SliverDeleter(Deleter): |
| 5 | model='Sliver' |
| 6 | |
| 7 | def call(self, pk): |
| 8 | sliver = Sliver.objects.get(pk=pk) |
| 9 | if sliver.instance_id: |
Tony Mack | bdb188a | 2014-04-01 20:24:47 -0400 | [diff] [blame] | 10 | driver = self.driver.client_driver(caller=sliver.creator, |
| 11 | tenant=sliver.slice.name, |
| 12 | deployment=sliver.deploymentNetwork.name) |
| 13 | driver.destroy_instance(sliver.instance_id) |
Tony Mack | 387a73f | 2013-09-18 07:59:14 -0400 | [diff] [blame] | 14 | sliver.delete() |