How to use the pylxd.exceptions.LXDAPIExtensionNotAvailable 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 lxc / pylxd / pylxd / client.py View on Github external
def assert_has_api_extension(self, name):
        """Asserts that the `name` api_extension exists.
        If not, then is raises the LXDAPIExtensionNotAvailable error.

        :param name: the api_extension to test for
        :type name: str
        :returns: None
        :raises: :class:`pylxd.exceptions.LXDAPIExtensionNotAvailable`
        """
        if not self.has_api_extension(name):
            raise exceptions.LXDAPIExtensionNotAvailable(name)
github lxc / pylxd / pylxd / models / network.py View on Github external
def _check_network_api_extension(client):
        """
        :param client: client instance
        :type client: :class:`~pylxd.client.Client`
        :raises: `exceptions.LXDAPIExtensionNotAvailable` when network
         operations API extension is not available.
        """
        if not Network.network_extension_available(client):
            raise LXDAPIExtensionNotAvailable(
                'Network creation is not available for this host')