How to use the pylxd.deprecation.deprecated 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 / container.py View on Github external
"""Create a new container config."""
        response = client.api.containers.post(json=config)

        if wait:
            Operation.wait_for_operation(client, response.json()['operation'])
        return cls(client, name=config['name'])

    def __init__(self, *args, **kwargs):
        super(Container, self).__init__(*args, **kwargs)

        self.snapshots = managers.SnapshotManager(self.client, self)
        self.files = self.FilesManager(self.client, self)

    # XXX: rockstar (28 Mar 2016) - This method was named improperly
    # originally. It's being kept here for backwards compatibility.
    reload = deprecated(
        "Container.reload is deprecated. Please use Container.sync")(
        model.Model.sync)

    def rename(self, name, wait=False):
        """Rename a container."""
        response = self.api.post(json={'name': name})

        if wait:
            Operation.wait_for_operation(
                self.client, response.json()['operation'])
        self.name = name

    def _set_state(self, state, timeout=30, force=True, wait=False):
        response = self.api.state.put(json={
            'action': state,
            'timeout': timeout,
github lxc / pylxd / pylxd / container.py View on Github external
    @deprecated('Container.get_file is deprecated. Please use Container.files.get')  # NOQA
    def get_file(self, filepath):  # pragma: no cover
        """Get a file from the container."""
        return self.files.get(filepath)
github lxc / pylxd / pylxd / container.py View on Github external
    @deprecated('Container.put_file is deprecated. Please use Container.files.put')  # NOQA
    def put_file(self, filepath, data):  # pragma: no cover
        """Put a file on the container."""
        return self.files.put(filepath, data)
github lxc / pylxd / pylxd / container.py View on Github external
    @deprecated('Container.list_snapshots is deprecated. Please use Container.snapshots.all')  # NOQA
    def list_snapshots(self):  # pragma: no cover
        """List all container snapshots."""
        return [s.name for s in self.snapshots.all()]
github lxc / pylxd / pylxd / container.py View on Github external
    @deprecated('Container.delete_snapshot is deprecated. Please use Snapshot.delete')  # NOQA
    def delete_snapshot(self, name, wait=False):  # pragma: no cover
        """Delete a snapshot."""
        snapshot = self.snapshots.get(name)
        snapshot.delete(wait=wait)
github lxc / pylxd / pylxd / container.py View on Github external
    @deprecated('Container.rename_snapshot is deprecated. Please use Snapshot.rename')  # NOQA
    def rename_snapshot(self, old, new, wait=False):  # pragma: no cover
        """Rename a snapshot."""
        snapshot = self.snapshots.get(old)
        snapshot.rename(new, wait=wait)
github lxc / pylxd / pylxd / container.py View on Github external
    @deprecated('Container.snapshot is deprecated. Please use Container.snapshots.create')  # NOQA
    def snapshot(self, name, stateful=False, wait=False):  # pragma: no cover
        """Take a snapshot of the container."""
        self.snapshots.create(name, stateful, wait)