diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index feccc3e69..a3118260e 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -61,7 +61,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { } if b.config.BundlePrefix == "" { - b.config.BundlePrefix = "image-{{.CreateTime}}" + b.config.BundlePrefix = "image-{{timestamp}}" } if b.config.BundleUploadCommand == "" { @@ -97,7 +97,6 @@ func (b *Builder) Prepare(raws ...interface{}) error { errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(b.config.tpl)...) validates := map[string]*string{ - "bundle_prefix": &b.config.BundlePrefix, "bundle_upload_command": &b.config.BundleUploadCommand, "bundle_vol_command": &b.config.BundleVolCommand, } @@ -113,6 +112,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { "account_id": &b.config.AccountId, "ami_name": &b.config.AMIName, "bundle_destination": &b.config.BundleDestination, + "bundle_prefix": &b.config.BundlePrefix, "s3_bucket": &b.config.S3Bucket, "x509_cert_path": &b.config.X509CertPath, "x509_key_path": &b.config.X509KeyPath, diff --git a/builder/amazon/instance/builder_test.go b/builder/amazon/instance/builder_test.go index f643cd9c3..c61a6f73d 100644 --- a/builder/amazon/instance/builder_test.go +++ b/builder/amazon/instance/builder_test.go @@ -115,7 +115,7 @@ func TestBuilderPrepare_BundlePrefix(t *testing.T) { t.Fatalf("err: %s", err) } - if b.config.BundlePrefix != "image-{{.CreateTime}}" { + if b.config.BundlePrefix == "" { t.Fatalf("bad: %s", b.config.BundlePrefix) } } diff --git a/builder/amazon/instance/step_bundle_volume.go b/builder/amazon/instance/step_bundle_volume.go index cd8b38f25..015d759db 100644 --- a/builder/amazon/instance/step_bundle_volume.go +++ b/builder/amazon/instance/step_bundle_volume.go @@ -5,8 +5,6 @@ import ( "github.com/mitchellh/goamz/ec2" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" - "strconv" - "time" ) type bundleCmdData struct { @@ -19,10 +17,6 @@ type bundleCmdData struct { PrivatePath string } -type bundlePrefixData struct { - CreateTime string -} - type StepBundleVolume struct{} func (s *StepBundleVolume) Run(state map[string]interface{}) multistep.StepAction { @@ -54,16 +48,6 @@ func (s *StepBundleVolume) Run(state map[string]interface{}) multistep.StepActio // Bundle the volume var err error - config.BundlePrefix, err = config.tpl.Process(config.BundlePrefix, bundlePrefixData{ - CreateTime: strconv.FormatInt(time.Now().UTC().Unix(), 10), - }) - if err != nil { - err := fmt.Errorf("Error processing bundle prefix: %s", err) - state["error"] = err - ui.Error(err.Error()) - return multistep.ActionHalt - } - config.BundleVolCommand, err = config.tpl.Process(config.BundleVolCommand, bundleCmdData{ AccountId: config.AccountId, Architecture: instance.Architecture,