From f6705491868494fb3b78139dad23f35cd99f12c7 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Tue, 1 Nov 2011 16:04:14 -0700 Subject: [PATCH] move from exercise.sh to exercises/.. --- exercises/euca.sh | 37 ++++++++++++++++++++++++ exercise.sh => exercises/floating_ips.sh | 5 ---- 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100755 exercises/euca.sh rename exercise.sh => exercises/floating_ips.sh (97%) diff --git a/exercises/euca.sh b/exercises/euca.sh new file mode 100755 index 0000000..faeffcf --- /dev/null +++ b/exercises/euca.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# **exercise.sh** - using the cloud can be fun + +# we will use the ``nova`` cli tool provided by the ``python-novaclient`` +# package +# + + +# This script exits on an error so that errors don't compound and you see +# only the first error that occured. +set -o errexit + +# Print the commands being run so that we can see the command that triggers +# an error. It is also useful for following allowing as the install occurs. +set -o xtrace + + +# Settings +# ======== + +# Use openrc + stackrc + localrc for settings +source ./openrc + +# Max time till the vm is bootable +BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} + +IMAGE=`euca-describe-images | grep machine | cut -f2` + +INSTANCE=`euca-run-instance $IMAGE | grep INSTANCE | cut -f2` + +if ! timeout $BOOT_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then + echo "server didn't become active within $BOOT_TIMEOUT seconds" + exit 1 +fi + +euca-terminate-instances $INSTANCE diff --git a/exercise.sh b/exercises/floating_ips.sh similarity index 97% rename from exercise.sh rename to exercises/floating_ips.sh index 99b0f3b..06a2cd4 100755 --- a/exercise.sh +++ b/exercises/floating_ips.sh @@ -186,8 +186,3 @@ nova secgroup-delete $SECGROUP # FIXME: validate shutdown within 5 seconds # (nova show $NAME returns 1 or status != ACTIVE)? -# Testing Euca2ools -# ================== - -# make sure that we can describe instances -euca-describe-instances