Skip to content

Commit

Permalink
Convert str to json format before evaluating length. (#574)
Browse files Browse the repository at this point in the history
Signed-off-by: nishipy <goodisonev4@gmail.com>
  • Loading branch information
nishipy authored Apr 6, 2023
1 parent 4149dec commit e8c2703
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/modules/podman_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,9 @@ def find_image(self, image_name=None):
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

Expand All @@ -547,8 +548,9 @@ def inspect_image(self, image_name=None):
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

Expand Down

0 comments on commit e8c2703

Please sign in to comment.