Merge "Use DEFAULT_INSTANCE_TYPE in exercises"
This commit is contained in:
commit
4b40c4d95f
@ -30,7 +30,8 @@ SECGROUP=euca_secgroup
|
|||||||
euca-add-group -d description $SECGROUP
|
euca-add-group -d description $SECGROUP
|
||||||
|
|
||||||
# Launch it
|
# Launch it
|
||||||
INSTANCE=`euca-run-instances -g $SECGROUP -t m1.tiny $IMAGE | grep INSTANCE | cut -f2`
|
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
|
||||||
|
INSTANCE=`euca-run-instances -g $SECGROUP -t $DEFAULT_INSTANCE_TYPE $IMAGE | grep INSTANCE | cut -f2`
|
||||||
|
|
||||||
# Assure it has booted within a reasonable time
|
# Assure it has booted within a reasonable time
|
||||||
if ! timeout $RUNNING_TIMEOUT sh -c "while ! euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then
|
if ! timeout $RUNNING_TIMEOUT sh -c "while ! euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then
|
||||||
|
@ -67,12 +67,16 @@ nova secgroup-create $SECGROUP "test_secgroup description"
|
|||||||
# List of flavors:
|
# List of flavors:
|
||||||
nova flavor-list
|
nova flavor-list
|
||||||
|
|
||||||
# and grab the first flavor in the list to launch
|
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
|
||||||
FLAVOR=`nova flavor-list | head -n 4 | tail -n 1 | cut -d"|" -f2`
|
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"
|
NAME="myserver"
|
||||||
|
|
||||||
nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP
|
nova boot --flavor $INSTANCE_TYPE --image $IMAGE $NAME --security_groups=$SECGROUP
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# =======
|
# =======
|
||||||
|
@ -52,10 +52,10 @@ IMAGE=`glance -A $TOKEN index | egrep ami | head -1 | cut -d" " -f1`
|
|||||||
# List of instance types:
|
# List of instance types:
|
||||||
nova flavor-list
|
nova flavor-list
|
||||||
|
|
||||||
INSTANCE_NAME=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
|
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
|
||||||
INSTANCE_TYPE=`nova flavor-list | grep $INSTANCE_NAME | cut -d"|" -f2`
|
INSTANCE_TYPE=`nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | cut -d"|" -f2`
|
||||||
if [[ -z "`nova flavor-list | grep $INSTANCE_NAME | cut -d"|" -f2`" ]]; then
|
if [[ -z "$INSTANCE_TYPE" ]]; then
|
||||||
# and grab the first flavor in the list to launch
|
# 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`
|
INSTANCE_TYPE=`nova flavor-list | head -n 4 | tail -n 1 | cut -d"|" -f2`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user