~fwereade/juju-core/strawman-state-test-simplification

« back to all changes in this revision

Viewing changes to environs/ec2/ec2.go

environs/ec2: specify public-bucket-region

Fixes LP #1083017

Our public bucket, juju-dist, lives in the us-east-1 region and can only be accessed via that endpoint. If you attempt to do so via another endpoint you get an unhelpful 301 error with an xml blob telling you how to request the bucket. The solution is to add a configuration option, with sensible default, to ec2/config.go to specify the region of the public bucket independantly of the private bucket.

R=jameinel, niemeyer
CC=
https://codereview.appspot.com/6854098

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
 
149
149
        auth := aws.Auth{ecfg.accessKey(), ecfg.secretKey()}
150
150
        region := aws.Regions[ecfg.region()]
 
151
        publicBucketRegion := aws.Regions[ecfg.publicBucketRegion()]
151
152
        e.ec2Unlocked = ec2.New(auth, region)
152
153
        e.s3Unlocked = s3.New(auth, region)
153
154
 
158
159
        }
159
160
        if ecfg.publicBucket() != "" {
160
161
                e.publicStorageUnlocked = &storage{
161
 
                        bucket: e.s3Unlocked.Bucket(ecfg.publicBucket()),
 
162
                        bucket: s3.New(auth, publicBucketRegion).Bucket(ecfg.publicBucket()),
162
163
                }
163
164
        } else {
164
165
                e.publicStorageUnlocked = nil