| Total Complexity | 4 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| 1 | import atexit |
||
| 9 | class BaseAction(Action): |
||
| 10 | def __init__(self, config): |
||
| 11 | super(BaseAction, self).__init__(config) |
||
| 12 | self.si = self._connect() |
||
| 13 | self.si_content = self.si.RetrieveContent() |
||
| 14 | |||
| 15 | def _connect(self): |
||
| 16 | si = connect.SmartConnect(host=self.config['host'], port=self.config['port'], |
||
| 17 | user=self.config['user'], pwd=self.config['passwd']) |
||
| 18 | atexit.register(connect.Disconnect, si) |
||
| 19 | return si |
||
| 20 | |||
| 21 | def _wait_for_task(self, task): |
||
| 22 | while task.info.state == vim.TaskInfo.State.running: |
||
| 23 | eventlet.sleep(1) |
||
| 24 | return task.info.state == vim.TaskInfo.State.success |
||
| 25 |