Handle more than 1 image while configuring tempest

[1] caused a regression causing failures when
more than 1 images are setup. Fixing it by correctly
using the array variable. Also add a break in the
for loop once if condition is met.

[1] https://review.opendev.org/c/openstack/devstack/+/886795

Closes-Bug: #2028123
Change-Id: I4f13c1239312bbcca8c65e875d65d03702161c18
diff --git a/lib/tempest b/lib/tempest
index 4f72a6d..4ba101f 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -259,9 +259,10 @@
                         image_uuid_alt=${images[1]}
                     fi
                 elif [ -z "$image_uuid_alt" ]; then
-                    for image in $images; do
+                    for image in ${images[@]}; do
                         if [[ "$image" != "$image_uuid" ]]; then
                             image_uuid_alt=$image
+                            break
                         fi
                     done
                 fi