def _get_api(self, wait): if wait: self.wait_for_ssh() try: testlib.assert_true_within_long( lambda: self.service('ovirt-engine').alive()) api = [] testlib.assert_true_within_short( lambda: api.append(self._create_api()) or True) except AssertionError: raise RuntimeError('Failed to connect to the engine') return api.pop()
def _get_api(self, wait): if wait: self.wait_for_ssh() try: testlib.assert_true_within_long( lambda: self.service('ovirt-engine').alive() ) api = [] testlib.assert_true_within_short( lambda: api.append(self._create_api()) or True ) except AssertionError: raise RuntimeError('Failed to connect to the engine') return api.pop()
def get(): instance = self._create_api() if instance: api.append(instance) return True return False