summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-12-04 08:16:15 -0800
committerGitHub <noreply@github.com>2018-12-04 08:16:15 -0800
commit480a179f019c343d8f778c0e0576390e7130b375 (patch)
tree0b80ed7b2ddfa8ee25ed295c53e9bb9a2b64341c
parent6c060b1ca45bfb96c71e7f2114f1f31f53d0084b (diff)
parent57f7b794002abb5f89d037eea30c964c92aca449 (diff)
downloadpodman-480a179f019c343d8f778c0e0576390e7130b375.tar.gz
podman-480a179f019c343d8f778c0e0576390e7130b375.tar.bz2
podman-480a179f019c343d8f778c0e0576390e7130b375.zip
Merge pull request #1894 from jwhonce/bug/1876
Only include container SizeRootFs when requested
-rw-r--r--contrib/python/pypodman/pypodman/lib/actions/inspect_action.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/contrib/python/pypodman/pypodman/lib/actions/inspect_action.py b/contrib/python/pypodman/pypodman/lib/actions/inspect_action.py
index 514b4702a..a581e7e4e 100644
--- a/contrib/python/pypodman/pypodman/lib/actions/inspect_action.py
+++ b/contrib/python/pypodman/pypodman/lib/actions/inspect_action.py
@@ -23,9 +23,9 @@ class Inspect(AbstractActionBase):
help='Type of object to inspect',
)
parser.add_argument(
- 'size',
+ '--size',
action='store_true',
- default=True,
+ default=False,
help='Display the total file size if the type is a container.'
' Always True.')
parser.add_argument(
@@ -59,7 +59,7 @@ class Inspect(AbstractActionBase):
def inspect(self):
"""Inspect provided podman objects."""
- output = {}
+ output = []
try:
for ident in self._args.objects:
obj = None
@@ -78,7 +78,13 @@ class Inspect(AbstractActionBase):
msg = 'Object "{}" not found'.format(ident)
print(msg, file=sys.stderr, flush=True)
else:
- output.update(obj._asdict())
+ fields = obj._asdict()
+ if not self._args.size:
+ try:
+ del fields['sizerootfs']
+ except KeyError:
+ pass
+ output.append(fields)
except podman.ErrorOccurred as e:
sys.stdout.flush()
print(