Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    def _get_api(self):
        try:
            api = []

            def get():
                instance = self._create_api()
                if instance:
                    api.append(instance)
                    return True
                return False

            testlib.assert_true_within_short(
                get,
                allowed_exceptions=[RequestError, ConnectionError],
            )
        except AssertionError:
            raise RuntimeError('Failed to connect to the engine')

        return api.pop()
Ejemplo n.º 4
0
    def _get_api(self):
        try:
            api = []

            def get():
                instance = self._create_api()
                if instance:
                    api.append(instance)
                    return True
                return False

            testlib.assert_true_within_short(
                get,
                allowed_exceptions=[RequestError, ConnectionError],
            )
        except AssertionError:
            raise RuntimeError('Failed to connect to the engine')

        return api.pop()