Octavia: handle empty amphora image search result

In some situations, openstack image list queries on name return a 0
exit code even though there is no result.

Note: this differs slightly from the original commit because the linters
are catching a new rule "comparison against empty strings" since the
original commit merged.

Change-Id: I20f63ea45e52181810654f7afab11499fef9baa2
Related-Bug: #1843059
(cherry picked from commit 5fccdd3c2c)
This commit is contained in:
Brent Eagles 2020-04-21 16:56:59 -02:30
parent 4ca3bd9459
commit 2d1a48b505
1 changed files with 3 additions and 0 deletions

View File

@ -44,7 +44,9 @@
set_fact:
image_id: "{{ glance_id_result.stdout }}"
when:
- glance_id_result.rc is defined
- glance_id_result.rc == 0
- (glance_id_result.stdout | length) > 0
- name: get checksum if there's an image in glance already
shell: |
@ -62,6 +64,7 @@
set_fact:
current_md5: "{{ glance_results.stdout }}"
when:
- glance_results.rc is defined
- glance_results.rc == 0
- name: determine if the image needs to be replaced