builder/amazon/instance: default x509_upload_path

This commit is contained in:
Mitchell Hashimoto 2013-07-25 10:51:38 -05:00
parent 321d1cce16
commit fc39042283
2 changed files with 6 additions and 6 deletions

View File

@ -81,6 +81,10 @@ func (b *Builder) Prepare(raws ...interface{}) error {
"--batch"
}
if b.config.X509UploadPath == "" {
b.config.X509UploadPath = "/tmp"
}
// Accumulate any errors
errs := common.CheckUnusedConfig(md)
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare()...)
@ -121,10 +125,6 @@ func (b *Builder) Prepare(raws ...interface{}) error {
errs, fmt.Errorf("x509_key_path points to bad file: %s", err))
}
if b.config.X509UploadPath == "" {
errs = packer.MultiErrorAppend(errs, errors.New("x509_upload_path is required"))
}
if errs != nil && len(errs.Errors) > 0 {
return errs
}

View File

@ -213,7 +213,7 @@ func TestBuilderPrepare_X509UploadPath(t *testing.T) {
config["x509_upload_path"] = ""
err := b.Prepare(config)
if err == nil {
t.Fatal("should have error")
if err != nil {
t.Fatalf("should not have error: %s", err)
}
}