Fix tempest flavors and DEFAULT_INSTANCE_TYPE

The flavor selection was broken if DEFAULT_INSTANCE_TYPE is defined
but not yet created, for example when it is created in local.sh.
This also has the side effect of setting flavor_ref_alt to the first
flavor where it was unset in the previous code.

Change-Id: I1fa48b3f90af45144c92298b6b07a4f7ee3b499f
This commit is contained in:
Dean Troyer 2012-12-12 17:09:57 -06:00 committed by Gerrit Code Review
parent 9bc47db29c
commit ceaa38b329

View File

@ -134,12 +134,14 @@ function configure_tempest() {
flavor_lines=`nova flavor-list` flavor_lines=`nova flavor-list`
IFS=$'\r\n' IFS=$'\r\n'
flavors="" flavors=""
if [[ -n "$DEFAULT_INSTANCE_TYPE" ]]; then
for line in $flavor_lines; do for line in $flavor_lines; do
if [ -z $DEFAULT_INSTANCE_TYPE ]; then f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`" flavors="$flavors $f"
else done
flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | grep "$DEFAULT_INSTANCE_TYPE" | cut -d' ' -f2`"
fi fi
for line in $flavor_lines; do
flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
done done
IFS=" " IFS=" "