builder/vmware-iso: set local output dir

This commit is contained in:
Jimmy The Dog 2017-02-24 12:46:00 +00:00
parent 56c5628205
commit f8df5f81db
2 changed files with 6 additions and 1 deletions

View File

@ -199,7 +199,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
default:
dir = new(vmwcommon.LocalOutputDir)
}
var localDir localOutputDir
if b.config.RemoteType != "" && b.config.Format != "" {
localDir = localOutputDir{b.config.OutputDir}
b.config.OutputDir = b.config.VMName
}
dir.SetOutputDir(b.config.OutputDir)
@ -210,6 +213,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
state.Put("config", &b.config)
state.Put("debug", b.config.PackerDebug)
state.Put("dir", dir)
state.Put("localDir", localDir)
state.Put("driver", driver)
state.Put("hook", hook)
state.Put("ui", ui)

View File

@ -59,7 +59,8 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
}
// Export the VM
outputPath := filepath.Join(c.OutputDir, c.VMName+"."+s.Format)
localDir := state.Get("localDir").(localOutputDir)
outputPath := filepath.Join(fmt.Sprintf("%v", localDir), c.VMName+"."+s.Format)
if s.Format == "ova" {
os.MkdirAll(outputPath, 0755)