~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to rackspace-generate-image-streams.bash

  • Committer: Aaron Bentley
  • Date: 2014-02-28 16:40:22 UTC
  • mto: This revision was merged to the branch mainline in revision 257.
  • Revision ID: aaron.bentley@canonical.com-20140228164022-kfip2tphn9m9invi
Add juju-backup script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
set -eu
3
 
export JUJU_HOME=~/cloud-city
4
 
source $JUJU_HOME/rackspacerc
5
 
set -x
6
 
 
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`
11
 
 
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
15
 
 
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
21
 
 
22
 
# Upload images directory to bucket
23
 
(cd $STREAMS_DIR && swift upload $BUCKET_NAME images)
24
 
 
25
 
CDN_URI=swift stat --os-storage-url $CDN_ENDPOINT $BUCKET_NAME|grep -i X-Cdn-Uri
26
 
echo ${CDN_URI#*: }/images