1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-03-22 02:29:08 +00:00

Update error message when pull set to false (#327)

This commit is contained in:
Sean Sullivan 2021-10-18 19:01:52 -04:00 committed by GitHub
parent c14703ac46
commit e90eb325ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -542,7 +542,11 @@ class PodmanImageManager(object):
rc, out, err = self._run(args, ignore_errors=True)
if rc != 0:
self.module.fail_json(msg='Failed to pull image {image_name}'.format(image_name=image_name))
if not self.pull:
self.module.fail_json(msg='Failed to find image {image_name} locally, image pull set to {pull_bool}'.format(
pull_bool=self.pull, image_name=image_name))
else:
self.module.fail_json(msg='Failed to pull image {image_name}'.format(image_name=image_name))
return self.inspect_image(out.strip())
def build_image(self):

View file

@ -179,6 +179,22 @@
- docker_build2 is not changed
- "'localhost/dockerimage:latest' in dockerimage_info.images[0]['RepoTags'][0]"
- name: push image that doesn't exit to nowhere
containers.podman.podman_image:
name: bad_image
pull: false
push: yes
register: bad_push
ignore_errors: true
- name: Ensure that Image failed correctly.
assert:
that:
- "bad_push is failed"
- "bad_push is not changed"
- "'Failed to find image bad_image' in bad_push.msg"
- "'image pull set to False' in bad_push.msg"
always:
- name: Cleanup images
containers.podman.podman_image: