Use DEFAULT_INSTANCE_TYPE in exercises
Change-Id: I5a98a3a4e8057f613a94054b08ff5439f1ccf7cd
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index dca6d5b..135c8c1 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -67,12 +67,16 @@
# List of flavors:
nova flavor-list
-# and grab the first flavor in the list to launch
-FLAVOR=`nova flavor-list | head -n 4 | tail -n 1 | cut -d"|" -f2`
+DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
+INSTANCE_TYPE=`nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | cut -d"|" -f2`
+if [[ -z "$INSTANCE_TYPE" ]]; then
+ # grab the first flavor in the list to launch if default doesn't exist
+ INSTANCE_TYPE=`nova flavor-list | head -n 4 | tail -n 1 | cut -d"|" -f2`
+fi
NAME="myserver"
-nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP
+nova boot --flavor $INSTANCE_TYPE --image $IMAGE $NAME --security_groups=$SECGROUP
# Testing
# =======