Total Complexity | 2 |
Total Lines | 14 |
Duplicated Lines | 0 % |
1 | from pyVmomi import vim |
||
6 | class RemoveVM(BaseAction): |
||
7 | |||
8 | def run(self, vm, delete_permanently): |
||
9 | si = self.si |
||
10 | |||
11 | vm_obj = vim.VirtualMachine(vm, stub=si._stub) |
||
12 | if delete_permanently: |
||
13 | task = vm_obj.Destroy_Task() |
||
14 | success = self._wait_for_task(task) |
||
15 | else: |
||
16 | vm_obj.UnregisterVM() |
||
17 | success = True |
||
18 | |||
19 | return {"success": success} |
||
20 |