1
0
Fork 0
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:
Sergey 2021-04-02 03:53:05 +03:00 committed by GitHub
parent 46020ecf80
commit 2b456dfe8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View file

@ -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():

View file

@ -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