Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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')