1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-03-22 02:29:08 +00:00

Convert str to json format before evaluating length. (#574)

Signed-off-by: nishipy <goodisonev4@gmail.com>
This commit is contained in:
nishipy 2023-04-06 19:44:26 +09:00 committed by GitHub
parent 4149dece62
commit e8c270370d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -524,8 +524,9 @@ class PodmanImageManager(object):
image_name = self.image_name
args = ['image', 'ls', image_name, '--format', 'json']
rc, images, err = self._run(args, ignore_errors=True)
images = json.loads(images)
if len(images) > 0:
return json.loads(images)
return images
else:
return None
@ -547,8 +548,9 @@ class PodmanImageManager(object):
image_name = self.image_name
args = ['inspect', image_name, '--format', 'json']
rc, image_data, err = self._run(args)
image_data = json.loads(image_data)
if len(image_data) > 0:
return json.loads(image_data)
return image_data
else:
return None