diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-07-16 17:29:50 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-23 18:53:44 +0000 |
commit | 9a18681ba62d1a297809c243607a7b3763131c36 (patch) | |
tree | 8333f8727fd7d32f81cb1f54754ccd138a7e1063 /contrib/python/pypodman/lib/actions/rm_action.py | |
parent | 8569ed03056ce39e0dc163747089ed4b60b1b9b1 (diff) | |
download | podman-9a18681ba62d1a297809c243607a7b3763131c36.tar.gz podman-9a18681ba62d1a297809c243607a7b3763131c36.tar.bz2 podman-9a18681ba62d1a297809c243607a7b3763131c36.zip |
[WIP] Refactor and simplify python builds
* pypodman namespaced in site-packages
* version numbers pulled from requirements.txt
* add python-podman spec file to install eggs
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Closes: #1106
Approved by: rhatdan
Diffstat (limited to 'contrib/python/pypodman/lib/actions/rm_action.py')
-rw-r--r-- | contrib/python/pypodman/lib/actions/rm_action.py | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/contrib/python/pypodman/lib/actions/rm_action.py b/contrib/python/pypodman/lib/actions/rm_action.py deleted file mode 100644 index bd8950bd6..000000000 --- a/contrib/python/pypodman/lib/actions/rm_action.py +++ /dev/null @@ -1,51 +0,0 @@ -"""Remote client command for deleting containers.""" -import sys - -import podman - -from .. import AbstractActionBase - - -class Rm(AbstractActionBase): - """Class for removing containers from storage.""" - - @classmethod - def subparser(cls, parent): - """Add Rm command to parent parser.""" - parser = parent.add_parser('rm', help='delete container(s)') - parser.add_argument( - '-f', - '--force', - action='store_true', - help=('force delete of running container(s).' - ' (default: %(default)s)')) - parser.add_argument( - 'targets', nargs='*', help='container id(s) to delete') - parser.set_defaults(class_=cls, method='remove') - - def __init__(self, args): - """Construct Rm class.""" - super().__init__(args) - if len(args.targets) < 1: - raise ValueError('You must supply at least one container id' - ' or name to be deleted.') - - def remove(self): - """Remove container(s).""" - for id in self._args.targets: - try: - ctnr = self.client.containers.get(id) - ctnr.remove(self._args.force) - print(id) - except podman.ContainerNotFound as e: - sys.stdout.flush() - print( - 'Container {} not found.'.format(e.name), - file=sys.stderr, - flush=True) - except podman.ErrorOccurred as e: - sys.stdout.flush() - print( - '{}'.format(e.reason).capitalize(), - file=sys.stderr, - flush=True) |