def stop(self): """Stop 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.stop() except podman.ErrorOccurred as ex: print('{}'.format(ex.reason).capitalize(), file=sys.stderr, flush=True) return 1 return 0
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
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
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