Clean up security groups in exercises
* fix problem with deleting security groups too early in
floating_ips.sh and euca.sh
* create and clean up security groups
* cosmetic cleanups
Change-Id: Ie45e03f889c540ec83f27a02b10e787060c5d4d7
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index 02259c0..77f020e 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -200,12 +200,12 @@
# Delete second floating IP
nova floating-ip-delete $TEST_FLOATING_IP || die "Failure deleting floating IP $TEST_FLOATING_IP"
-# shutdown the server
+# Shutdown the server
nova delete $VM_UUID || die "Failure deleting instance $NAME"
-# make sure the VM shuts down within a reasonable time
-if ! timeout $TERMINATE_TIMEOUT sh -c "while nova show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then
- echo "server didn't shut down!"
+# Wait for termination
+if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q $VM_UUID; do sleep 1; done"; then
+ echo "Server $NAME not deleted"
exit 1
fi