builder/amazon: Fix S3 endpoint URL for instance-store builds

The S3 endpoint URLs don't always include the region name. See:

    http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

This mapping is already provided by `goamz` via `region.S3Endpoint`,
so let's use it.
This commit is contained in:
Alan Grosskurth 2014-02-23 22:41:23 -08:00
parent 4fc1087fcd
commit af89b31a40
2 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
"-s {{.SecretKey}} " +
"-d {{.BundleDirectory}} " +
"--batch " +
"--url https://s3-{{.Region}}.amazonaws.com " +
"--url {{.S3Endpoint}} " +
"--retry"
}

View File

@ -11,7 +11,7 @@ type uploadCmdData struct {
BucketName string
BundleDirectory string
ManifestPath string
Region string
S3Endpoint string
SecretKey string
}
@ -37,7 +37,7 @@ func (s *StepUploadBundle) Run(state multistep.StateBag) multistep.StepAction {
BucketName: config.S3Bucket,
BundleDirectory: config.BundleDestination,
ManifestPath: manifestPath,
Region: region.Name,
S3Endpoint: region.S3Endpoint,
SecretKey: config.SecretKey,
})
if err != nil {