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