Wait for instance termination to complete.

This patch waits for instance termination to complete before trying to
delete the security group.  The last change to simply move the security
group deletion to after euca-terminate-instance was not sufficient, as
it has to wait until the termination is complete.

Change-Id: Icba579534f324afb4d44abd42d8c755834dd2a57
This commit is contained in:
Russell Bryant 2012-02-22 11:19:32 -05:00
parent e7ed17eea4
commit 243b26a84e
2 changed files with 9 additions and 0 deletions

View File

@ -95,5 +95,11 @@ fi
# Terminate instance # Terminate instance
euca-terminate-instances $INSTANCE euca-terminate-instances $INSTANCE
# Assure it has terminated within a reasonable time
if ! timeout $TERMINATE_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then
echo "server didn't terminate within $TERMINATE_TIMEOUT seconds"
exit 1
fi
# Delete group # Delete group
euca-delete-group $SECGROUP euca-delete-group $SECGROUP

3
openrc
View File

@ -89,3 +89,6 @@ export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
# Max time to wait for proper IP association and dis-association. # Max time to wait for proper IP association and dis-association.
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
# Max time to wait for a vm to terminate
export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}