builder/vmware: correctly default export format to ovf

This commit is contained in:
Matthew Hooker 2017-02-10 00:49:47 -08:00
parent 0e80d98805
commit fdeadfe3f6
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 8 additions and 6 deletions

View File

@ -212,12 +212,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
}
}
if b.config.Format != "" {
if b.config.Format == "" {
b.config.Format = "ovf"
}
if !(b.config.Format == "ova" || b.config.Format == "ovf" || b.config.Format == "vmx") {
errs = packer.MultiErrorAppend(errs,
fmt.Errorf("format must be one of ova, ovf, or vmx"))
}
}
// Warnings
if b.config.ShutdownCommand == "" {
@ -256,7 +258,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
exportOutputPath := b.config.OutputDir
if b.config.RemoteType != "" && b.config.Format != "" {
if b.config.RemoteType != "" {
b.config.OutputDir = b.config.VMName
}
dir.SetOutputDir(b.config.OutputDir)