mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:28:24 +08:00
Only include container SizeRootFs when requested
* API always returns value, so we remove it if not asked for Fixes #1876 Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
@ -23,9 +23,9 @@ class Inspect(AbstractActionBase):
|
|||||||
help='Type of object to inspect',
|
help='Type of object to inspect',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'size',
|
'--size',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=True,
|
default=False,
|
||||||
help='Display the total file size if the type is a container.'
|
help='Display the total file size if the type is a container.'
|
||||||
' Always True.')
|
' Always True.')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -59,7 +59,7 @@ class Inspect(AbstractActionBase):
|
|||||||
|
|
||||||
def inspect(self):
|
def inspect(self):
|
||||||
"""Inspect provided podman objects."""
|
"""Inspect provided podman objects."""
|
||||||
output = {}
|
output = []
|
||||||
try:
|
try:
|
||||||
for ident in self._args.objects:
|
for ident in self._args.objects:
|
||||||
obj = None
|
obj = None
|
||||||
@ -78,7 +78,13 @@ class Inspect(AbstractActionBase):
|
|||||||
msg = 'Object "{}" not found'.format(ident)
|
msg = 'Object "{}" not found'.format(ident)
|
||||||
print(msg, file=sys.stderr, flush=True)
|
print(msg, file=sys.stderr, flush=True)
|
||||||
else:
|
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:
|
except podman.ErrorOccurred as e:
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
print(
|
print(
|
||||||
|
Reference in New Issue
Block a user