Skip to content

Commit

Permalink
Adds extra checks when OCP images task fails (#8589)
Browse files Browse the repository at this point in the history
* Adds extra checks when OCP images task fails

Signed-off-by: Alberto Losada <[email protected]>

* Removes trailing spaces

Signed-off-by: Alberto Losada <[email protected]>

---------

Signed-off-by: Alberto Losada <[email protected]>
  • Loading branch information
alosadagrande authored Sep 23, 2024
1 parent d704c6e commit f7b9563
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,15 +541,30 @@
ansible.builtin.stat:
path: "/opt/webcache/data/{{ rhcos_live_image }}"
register: rhcos_live_image_file
- name: "{{ rhcos_live_image }} was not downloaded. Re-downloading again..."
ansible.builtin.get_url:
url: "{{ rhcos_live_image_url }}"
dest: "/opt/webcache/data/"
mode: "0644"
register: download_live_result
until: not download_live_result.failed
retries: 3
delay: 10
when: not rhcos_live_image_file.stat.exists
- name: Check status of {{ rhcos_rootfs_image }}
ansible.builtin.stat:
path: "/opt/webcache/data/{{ rhcos_rootfs_image }}"
register: rhcos_rootfs_image_file
- name: Fail if files were not downloaded
ansible.builtin.fail:
msg: "rootfs or image files were not downloaded successfully"
when: (not rhcos_live_image_file.stat.exists or not rhcos_rootfs_image_file.stat.exists)

- name: "{{ rhcos_rootfs_image }} was not downloaded. Re-downloading again..."
ansible.builtin.get_url:
url: "{{ rhcos_rootfs_image_url }}"
dest: "/opt/webcache/data/"
mode: "0644"
register: download_rootfs_result
until: not download_rootfs_result.failed
retries: 3
delay: 10
when: not rhcos_rootfs_image_file.stat.exists

# Leave this as the last task in the playbook.
- name: pre_workload tasks complete
Expand Down

0 comments on commit f7b9563

Please sign in to comment.