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 540a6be329)
This commit is contained in:
Jimmy McCrory 2018-04-05 11:38:27 -07:00 committed by Jesse Pretorius (odyssey4me)
parent ab0d01abce
commit 2091921509
1 changed files with 8 additions and 1 deletions

View File

@ -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: