Commit af89b31a authored by Alan Grosskurth's avatar Alan Grosskurth

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.
parent 4fc1087f
...@@ -74,7 +74,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { ...@@ -74,7 +74,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
"-s {{.SecretKey}} " + "-s {{.SecretKey}} " +
"-d {{.BundleDirectory}} " + "-d {{.BundleDirectory}} " +
"--batch " + "--batch " +
"--url https://s3-{{.Region}}.amazonaws.com " + "--url {{.S3Endpoint}} " +
"--retry" "--retry"
} }
......
...@@ -11,7 +11,7 @@ type uploadCmdData struct { ...@@ -11,7 +11,7 @@ type uploadCmdData struct {
BucketName string BucketName string
BundleDirectory string BundleDirectory string
ManifestPath string ManifestPath string
Region string S3Endpoint string
SecretKey string SecretKey string
} }
...@@ -37,7 +37,7 @@ func (s *StepUploadBundle) Run(state multistep.StateBag) multistep.StepAction { ...@@ -37,7 +37,7 @@ func (s *StepUploadBundle) Run(state multistep.StateBag) multistep.StepAction {
BucketName: config.S3Bucket, BucketName: config.S3Bucket,
BundleDirectory: config.BundleDestination, BundleDirectory: config.BundleDestination,
ManifestPath: manifestPath, ManifestPath: manifestPath,
Region: region.Name, S3Endpoint: region.S3Endpoint,
SecretKey: config.SecretKey, SecretKey: config.SecretKey,
}) })
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment