blob: ca35c9afa31221e0e601eef8dc4e623930500224 [file] [log] [blame]
Vishvananda Ishaya75bbd752012-01-19 23:28:46 +00001#!/usr/bin/env bash
2
3# we will use the ``euca2ools`` cli tool that wraps the python boto
4# library to test ec2 compatibility
5#
6
7# This script exits on an error so that errors don't compound and you see
8# only the first error that occured.
9set -o errexit
10
11# Print the commands being run so that we can see the command that triggers
12# an error. It is also useful for following allowing as the install occurs.
13set -o xtrace
14
15# Settings
16# ========
17
18# Use openrc + stackrc + localrc for settings
19pushd $(cd $(dirname "$0")/.. && pwd)
20source ./openrc
21
22# Remove old certificates
23rm -f cacert.pem
24rm -f cert.pem
25rm -f pk.pem
26
27# Get Certificates
28nova x509-get-root-cert
29nova x509-create-cert
30popd
31
32# Max time to wait for image to be registered
33REGISTER_TIMEOUT=${REGISTER_TIMEOUT:-15}
34
35BUCKET=testbucket
36IMAGE=bundle.img
37truncate -s 5M /tmp/$IMAGE
38euca-bundle-image -i /tmp/$IMAGE
39
40
41euca-upload-bundle -b $BUCKET -m /tmp/$IMAGE.manifest.xml
42AMI=`euca-register $BUCKET/$IMAGE.manifest.xml | cut -f2`
43
44# Wait for the image to become available
45if ! timeout $REGISTER_TIMEOUT sh -c "while euca-describe-images | grep '$AMI' | grep 'available'; do sleep 1; done"; then
46 echo "Image $AMI not available within $REGISTER_TIMEOUT seconds"
47 exit 1
48fi