3
export JUJU_HOME=~/cloud-city
4
source $JUJU_HOME/rackspacerc
7
BUCKET_NAME=${1:-juju-ci-image-streams}
8
IMAGE_ID=`nova image-list|grep "14\.04.*PVHVM"|cut -d "|" -f 2`
9
STREAMS_DIR=`mktemp -d -t juju-ci-image-metadata.XXXXXX`
10
CDN_ENDPOINT=`keystone endpoint-get --service "rax:object-cdn"|grep publicURL|cut -d "|" -f 3`
12
# Create simplestreams for trusty image
13
juju metadata generate-image -d $STREAMS_DIR -i $IMAGE_ID -s trusty \
14
-r $OS_REGION_NAME -u $OS_AUTH_URL
16
# Allow read access to bucket without token
17
swift post -r ".r:*" $BUCKET_NAME
18
# Enable CDN replication for bucket via rax:object-cdn service
19
# <https://developer.rackspace.com/docs/cloud-files/getting-started/>
20
swift post --os-storage-url $CDN_ENDPOINT --header "X-CDN-Enabled: True" $BUCKET_NAME
22
# Upload images directory to bucket
23
(cd $STREAMS_DIR && swift upload $BUCKET_NAME images)
25
CDN_URI=swift stat --os-storage-url $CDN_ENDPOINT $BUCKET_NAME|grep -i X-Cdn-Uri
26
echo ${CDN_URI#*: }/images