devstack/exercises/bundle.sh
Dean Troyer 80756ea71a Blueprint cli-auth
* Add proper test for swift in client-env.sh
* Remove all VERIFY variables; nothing beyond the 4 OS_ vars is set now
* Update exercises for Keystone 2.0 auth
* swift understands Keystone 2.0 auth now, don't download custom binary
* cleanup uploaded bundle in bundle.sh

Change-Id: I99c818d81534bbf93c0e142513acb80e5fe613ea
2012-02-13 23:49:15 -06:00

52 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# we will use the ``euca2ools`` cli tool that wraps the python boto
# library to test ec2 compatibility
#
# 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
pushd $(cd $(dirname "$0")/.. && pwd)
source ./openrc
# Remove old certificates
rm -f cacert.pem
rm -f cert.pem
rm -f pk.pem
# Get Certificates
nova x509-get-root-cert
nova x509-create-cert
popd
# Max time to wait for image to be registered
REGISTER_TIMEOUT=${REGISTER_TIMEOUT:-15}
BUCKET=testbucket
IMAGE=bundle.img
truncate -s 5M /tmp/$IMAGE
euca-bundle-image -i /tmp/$IMAGE
euca-upload-bundle -b $BUCKET -m /tmp/$IMAGE.manifest.xml
AMI=`euca-register $BUCKET/$IMAGE.manifest.xml | cut -f2`
# Wait for the image to become available
if ! timeout $REGISTER_TIMEOUT sh -c "while euca-describe-images | grep '$AMI' | grep 'available'; do sleep 1; done"; then
echo "Image $AMI not available within $REGISTER_TIMEOUT seconds"
exit 1
fi
# Clean up
euca-deregister $AMI