From e8c270370dd9b78dee05348c357c8290880ffc1c Mon Sep 17 00:00:00 2001 From: nishipy <41185206+nishipy@users.noreply.github.com> Date: Thu, 6 Apr 2023 19:44:26 +0900 Subject: [PATCH] Convert str to json format before evaluating length. (#574) Signed-off-by: nishipy --- plugins/modules/podman_image.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/modules/podman_image.py b/plugins/modules/podman_image.py index 570417b..b7a9f10 100644 --- a/plugins/modules/podman_image.py +++ b/plugins/modules/podman_image.py @@ -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