How to use the podman.PodNotFound function in podman

To help you get started, we’ve selected a few podman 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 containers / podman / contrib / python / pypodman / pypodman / lib / actions / pod / unpause_parser.py View on Github external
def unpause(self):
        """Unpause containers in provided Pod."""
        idents = None if self._args.all else self._args.pod
        pods = query_pods(self.client.pods, idents)

        for pod in pods:
            try:
                pod.unpause()
                print(pod.id)
            except podman.PodNotFound as ex:
                print(
                    'Pod "{}" not found'.format(ex.name),
                    file=sys.stderr,
                    flush=True)
            except podman.ErrorOccurred as ex:
                print(
                    '{}'.format(ex.reason).capitalize(),
                    file=sys.stderr,
                    flush=True)
                return 1
        return 0
github containers / podman / contrib / python / pypodman / pypodman / lib / __init__.py View on Github external
def query_model(model, identifiers=None):
    """Retrieve all (default) or given model(s)."""
    objs = []
    if identifiers is None:
        objs.extend(model.list())
    else:
        try:
            for ident in identifiers:
                objs.append(model.get(ident))
        except (
                podman.PodNotFound,
                podman.ImageNotFound,
                podman.ContainerNotFound,
        ) as ex:
            print(
                '"{}" not found'.format(ex.name), file=sys.stderr, flush=True)
    return objs
github containers / podman / contrib / python / pypodman / pypodman / lib / actions / pod / remove_parser.py View on Github external
def remove(self):
        """Remove pod and container(s)."""
        idents = None if self._args.all else self._args.pod
        pods = query_pods(self.client.pods, idents)

        for pod in pods:
            try:
                pod.remove(self._args.force)
                print(pod.id)
            except podman.PodNotFound as ex:
                print(
                    'Pod "{}" not found.'.format(ex.name),
                    file=sys.stderr,
                    flush=True)
            except podman.ErrorOccurred as ex:
                print(
                    '{}'.format(ex.reason).capitalize,
                    file=sys.stderr,
                    flush=True)
                return 1
        return 0
github containers / podman / contrib / python / pypodman / pypodman / lib / actions / pod / pause_parser.py View on Github external
def pause(self):
        """Pause containers in provided Pod."""
        idents = None if self._args.all else self._args.pod
        pods = query_pods(self.client.pods, idents)

        for pod in pods:
            try:
                pod.pause()
                print(pod.id)
            except podman.PodNotFound as ex:
                print(
                    'Pod "{}" not found'.format(ex.name),
                    file=sys.stderr,
                    flush=True)
            except podman.ErrorOccurred as ex:
                print(
                    '{}'.format(ex.reason).capitalize(),
                    file=sys.stderr,
                    flush=True)
                return 1
        return 0
github containers / podman / contrib / python / pypodman / pypodman / lib / actions / pod / restart_parser.py View on Github external
def restart(self):
        """Restart pod and container(s)."""
        idents = None if self._args.all else self._args.pod
        pods = query_pods(self.client.pods, idents)

        for pod in pods:
            try:
                pod.restart()
                print(pod.id)
            except podman.PodNotFound as ex:
                print(
                    'Pod "{}" not found.'.format(ex.name),
                    file=sys.stderr,
                    flush=True)
            except podman.ErrorOccurred as ex:
                print(
                    '{}'.format(ex.reason).capitalize(),
                    file=sys.stderr,
                    flush=True)
                return 1
        return 0
github containers / podman / contrib / python / pypodman / pypodman / lib / actions / pod / kill_parser.py View on Github external
def kill(self):
        """Signal provided pods."""
        idents = None if self._args.all else self._args.pod
        pods = query_pods(self.client.pods, idents)

        for pod in pods:
            try:
                pod.kill(self._args.signal)
                print(pod.id)
            except podman.PodNotFound as ex:
                print(
                    'Pod "{}" not found.'.format(ex.name),
                    file=sys.stderr,
                    flush=True)
            except podman.ErrorOccurred as e:
                print(
                    '{}'.format(e.reason).capitalize(),
                    file=sys.stderr,
                    flush=True)
                return 1
        return 0