From 2091921509a4bc9de012747b879dcc6e47057c9e Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Thu, 5 Apr 2018 11:38:27 -0700 Subject: [PATCH] Allow for single tempest image upload If 'tempest_images' has been overridden to only contain a single image, setting a fact for a secondary image will fail since it always expects 'tempest_image_create' to contain two elements. Instead, set the 'tempest_glance_image_id_2' fact as the last element. Change-Id: If4bbd73f70bfb59695bb7d5f167ed6555e6de16a (cherry picked from commit 540a6be329d78df6a195bf1749364c6f514cefe9) --- tasks/tempest_resources.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tasks/tempest_resources.yml b/tasks/tempest_resources.yml index b763f49d..1863ac79 100644 --- a/tasks/tempest_resources.yml +++ b/tasks/tempest_resources.yml @@ -13,6 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Ensures you have at least one image to upload + assert: + that: + - "tempest_images | length > 0" + when: + - tempest_service_available_glance | bool + - name: Create deployment-host tempest_image_dir file: path: "{{ tempest_image_dir }}" @@ -70,7 +77,7 @@ - name: Store first tempest image id set_fact: tempest_glance_image_id_1: "{{ tempest_service_available_glance | ternary(tempest_image_create['results'][0]['id'], '') }}" - tempest_glance_image_id_2: "{{ tempest_service_available_glance | ternary(tempest_image_create['results'][1]['id'], '') }}" + tempest_glance_image_id_2: "{{ tempest_service_available_glance | ternary(tempest_image_create['results'][-1]['id'], '') }}" - name: Ensure tempest tenants keystone: