podman: only check image availability when inspecting image

When a paunch command (e.g. 'paunch list') requires inspection
of a container, it passes the container id to inspect, so we
cannot check for image availability at this time (we probably
don't need to anyway because the container exists).

Only check for image availability if the inspect function is
requested to inspect an image.

Change-Id: I8491eddaae172c8cf0b386d4731ab72dc113049c
This commit is contained in:
Damien Ciabrini 2019-01-11 17:07:26 +01:00
parent 99ac720bf6
commit 1aef17a4ff
1 changed files with 6 additions and 4 deletions

View File

@ -94,11 +94,13 @@ class BaseRunner(object):
def inspect(self, name, output_format=None, o_type='container',
quiet=False):
img_exist = self.image_exist(name)
# We want to verify if the image exists before inspecting it.
# If we're being asked to inspect a container image, we
# want to verify that the image exists before inspecting it.
# Context: https://github.com/containers/libpod/issues/1845
if img_exist != 0:
return
if o_type == 'image':
img_exist = self.image_exist(name)
if img_exist != 0:
return
cmd = [self.cont_cmd, 'inspect', '--type', o_type]
if output_format:
cmd.append('--format')