| ... | ... |
@@ -82,30 +82,34 @@ function configure_tempest() {
|
| 82 | 82 |
# first image returned and set ``image_uuid_alt`` to the second, |
| 83 | 83 |
# if there is more than one returned... |
| 84 | 84 |
# ... Also ensure we only take active images, so we don't get snapshots in process |
| 85 |
- image_lines=`glance image-list` |
|
| 86 |
- IFS=$'\n\r' |
|
| 87 |
- images="" |
|
| 88 |
- for line in $image_lines; do |
|
| 89 |
- if [ -z $DEFAULT_IMAGE_NAME ]; then |
|
| 90 |
- images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`" |
|
| 91 |
- else |
|
| 92 |
- images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | grep "$DEFAULT_IMAGE_NAME" | cut -d' ' -f2`" |
|
| 85 |
+ declare -a images |
|
| 86 |
+ |
|
| 87 |
+ while read -r IMAGE_NAME IMAGE_UUID; do |
|
| 88 |
+ if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then |
|
| 89 |
+ image_uuid="$IMAGE_UUID" |
|
| 90 |
+ image_uuid_alt="$IMAGE_UUID" |
|
| 93 | 91 |
fi |
| 94 |
- done |
|
| 95 |
- # Create array of image UUIDs... |
|
| 96 |
- IFS=" " |
|
| 97 |
- images=($images) |
|
| 98 |
- num_images=${#images[*]}
|
|
| 99 |
- echo "Found $num_images images" |
|
| 100 |
- if [[ $num_images -eq 0 ]]; then |
|
| 101 |
- echo "Found no valid images to use!" |
|
| 102 |
- exit 1 |
|
| 103 |
- fi |
|
| 104 |
- image_uuid=${images[0]}
|
|
| 105 |
- image_uuid_alt=$image_uuid |
|
| 106 |
- if [[ $num_images -gt 1 ]]; then |
|
| 107 |
- image_uuid_alt=${images[1]}
|
|
| 108 |
- fi |
|
| 92 |
+ images+=($IMAGE_UUID) |
|
| 93 |
+ done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
|
|
| 94 |
+ |
|
| 95 |
+ case "${#images[*]}" in
|
|
| 96 |
+ 0) |
|
| 97 |
+ echo "Found no valid images to use!" |
|
| 98 |
+ exit 1 |
|
| 99 |
+ ;; |
|
| 100 |
+ 1) |
|
| 101 |
+ if [ -z "$image_uuid" ]; then |
|
| 102 |
+ image_uuid=${images[0]}
|
|
| 103 |
+ image_uuid_alt=${images[0]}
|
|
| 104 |
+ fi |
|
| 105 |
+ ;; |
|
| 106 |
+ *) |
|
| 107 |
+ if [ -z "$image_uuid" ]; then |
|
| 108 |
+ image_uuid=${images[0]}
|
|
| 109 |
+ image_uuid_alt=${images[1]}
|
|
| 110 |
+ fi |
|
| 111 |
+ ;; |
|
| 112 |
+ esac |
|
| 109 | 113 |
|
| 110 | 114 |
# Create tempest.conf from tempest.conf.sample |
| 111 | 115 |
# copy every time, because the image UUIDS are going to change |