| Total Complexity | 4 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| 1 | from lib import actions |
||
| 9 | class WaitForCAASServerOperationAction(actions.BaseAction): |
||
| 10 | |||
| 11 | def run(self, region, id): |
||
|
|
|||
| 12 | node = self.getNode(region, id) |
||
| 13 | if node is not None: |
||
| 14 | while(node.extra['status'].action == 'None'): |
||
| 15 | sleep(5) |
||
| 16 | node = self.getNode(region, id) |
||
| 17 | else: |
||
| 18 | raise "VM with the name doesn't exist" |
||
| 19 | |||
| 20 | |||
| 21 | def getNode(self, region, id): |
||
| 22 | driver = self._get_compute_driver(region) |
||
| 23 | node = driver.ex_get_node_by_id(id) |
||
| 24 | return node |
||
| 25 |
It is generally discouraged to redefine built-ins as this makes code very hard to read.