Skip to content

Commit 34f4124

Browse files
authored
Move precheck to the top
Lets fail early if the image doesn't exist.
1 parent 68e992c commit 34f4124

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

etc/kayobe/ansible/octavia-amphora-image-register.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@
1313
lookup('env', 'OS_USERNAME') != 'octavia' or
1414
lookup('env', 'OS_PROJECT_NAME') != 'service'
1515
16+
- name: Get image checksum
17+
stat:
18+
path: "{{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2"
19+
checksum_algorithm: md5
20+
changed_when: false
21+
register: image_checksum
22+
23+
- name: Assert that Amphora image exists
24+
assert:
25+
that: image_checksum.stat.exists
26+
fail_msg: |
27+
The amphora image: {{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2
28+
does not exist. Did you build the image?
29+
1630
- name: Set up openstack virtualenv
1731
pip:
1832
virtualenv: "{{ venv }}"
@@ -34,21 +48,6 @@
3448
image: amphora-x64-haproxy
3549
register: image_info
3650

37-
- name: Get image checksum
38-
stat:
39-
path: "{{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2"
40-
checksum_algorithm: md5
41-
changed_when: false
42-
register: image_checksum
43-
when: image_info.image
44-
45-
- name: Assert that Amphora image exists
46-
assert:
47-
that: image_checksum.stat.exists
48-
fail_msg: |
49-
The amphora image: {{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2
50-
does not exist. Did you build the image?
51-
5251
- name: Ensure Octavia Amphora image is renamed
5352
vars:
5453
ansible_python_interpreter: "{{ venv }}/bin/python"

0 commit comments

Comments
 (0)