1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Fix list tags failure in podman_search (#875)

Fix #874
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sergey 2024-11-05 14:35:07 +02:00 committed by GitHub
parent 4c84135f5d
commit a77ca6ab85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View file

@ -87,10 +87,11 @@ def search_images(module, executable, term, limit, list_tags):
command.extend(['--list-tags'])
rc, out, err = module.run_command(command)
if rc != 0 and list_tags and out == "" and "fetching tags list" in err:
return out, err
if rc != 0:
module.fail_json(msg="Unable to gather info for '{0}': {1}".format(term, err))
return out
return out, err
def main():
@ -110,7 +111,7 @@ def main():
list_tags = module.params.get('list_tags')
executable = module.get_bin_path(executable, required=True)
result_str = search_images(module, executable, term, limit, list_tags)
result_str, errors = search_images(module, executable, term, limit, list_tags)
if result_str == "":
results = []
else:
@ -121,7 +122,8 @@ def main():
results = dict(
changed=False,
images=results
images=results,
stderr=errors,
)
module.exit_json(**results)