mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Fix error with images info where no images (#233)
This commit is contained in:
parent
46020ecf80
commit
2b456dfe8c
2 changed files with 17 additions and 5 deletions
|
|
@ -197,10 +197,12 @@ def get_image_info(module, executable, name):
|
|||
def get_all_image_info(module, executable):
|
||||
command = [executable, 'image', 'ls', '-q']
|
||||
rc, out, err = module.run_command(command)
|
||||
name = out.strip().split('\n')
|
||||
out = get_image_info(module, executable, name)
|
||||
|
||||
return out
|
||||
out = out.strip()
|
||||
if out:
|
||||
name = out.split('\n')
|
||||
res = get_image_info(module, executable, name)
|
||||
return res
|
||||
return json.dumps([])
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
- name: Test podman_image_info
|
||||
block:
|
||||
|
||||
- name: Get info on images when no images
|
||||
containers.podman.podman_image_info:
|
||||
register: info_0
|
||||
|
||||
- name: Check results for no images
|
||||
assert:
|
||||
that:
|
||||
- info_0.images | length == 0
|
||||
|
||||
- name: Pull image
|
||||
command: podman pull quay.io/coreos/etcd
|
||||
|
||||
|
|
@ -15,7 +25,7 @@
|
|||
name: dnsmasq
|
||||
register: named_image_result
|
||||
|
||||
- name:
|
||||
- name: Check results
|
||||
assert:
|
||||
that:
|
||||
- all_image_result.images | length > 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue