Total Complexity | 2 |
Total Lines | 12 |
Duplicated Lines | 0 % |
1 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more |
||
20 | class StopVM(BaseAction): |
||
21 | |||
22 | def run(self, vm, kill=False): |
||
23 | # convert ids to stubs |
||
24 | vm_obj = inventory.get_virtualmachine(self.si_content, moid=vm) |
||
25 | if kill: |
||
26 | vm_obj.TerminateVM() |
||
27 | success = True |
||
28 | else: |
||
29 | task = vm_obj.PowerOffVM_Task() |
||
30 | success = self._wait_for_task(task) |
||
31 | return {'success': success} |
||
32 |