How to use the pylxd.exceptions.APIError function in pylxd

To help you get started, we’ve selected a few pylxd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / manila / manila / share / drivers / lxd.py View on Github external
def wait():
            LOG.debug("Wait operation %s...", operation)
            try:
                state, info = self.api.operation_info(operation)
                LOG.debug("Operation details: %s.", info)
            except pylxd_exc.APIError as e:
                LOG.exception(e)
                return True
            except Exception as e:
                LOG.exception(e)
                raise exception.ManilaException(
                    _("Cannot get operation info: %s.") % e
                )

            return (
                six.text_type(info["metadata"]["status"]).lower() != "running"
            )
github lxc / pylxd / pylxd / deprecated / utils.py View on Github external
def get_lxd_error(state, data):
    status_code = data.get('error_code')
    error = data.get('error')
    raise exceptions.APIError(error, status_code)