Try downloading the image when inspecting if not available
Currently if you don't have the image on the undercloud, when you try to run image modify it will fail. Instead of requiring the user pre-download the image prior to running the image modify script, let's attempt a pull if the image doesn't exist. Change-Id: Ib47331197f27c20281ff86b381cde2a2d8b61519 Closes-Bug: #1835219
This commit is contained in:
parent
1415b042f5
commit
ca052a10bd
|
@ -8,12 +8,27 @@
|
|||
delay: 5
|
||||
until: source_image_facts.images is defined
|
||||
register: source_image_facts
|
||||
- block:
|
||||
- name: Pull Docker image if not currently downloaded
|
||||
docker_image:
|
||||
name: "{{ source_image }}"
|
||||
- name: Inspect image with Docker
|
||||
docker_image_facts:
|
||||
name: "{{ source_image }}"
|
||||
retries: 5
|
||||
delay: 5
|
||||
until: source_image_facts.images is defined
|
||||
register: source_image_facts
|
||||
when: source_image_facts.images | length == 0
|
||||
- name: Set original_user with Docker
|
||||
set_fact:
|
||||
original_user: "{{ source_image_facts.images[0].Config.User }}"
|
||||
|
||||
- when: container_build_tool == 'buildah'
|
||||
block:
|
||||
- name: Ensure image exists
|
||||
shell: podman image exists {{ source_image }} || podman pull {{ source_image }}
|
||||
become: true
|
||||
- name: Inspect image with Buildah
|
||||
command: buildah inspect {{ source_image }}
|
||||
register: source_image_facts
|
||||
|
|
Loading…
Reference in New Issue