remove unnecessary checks; we always default format to ovf if it is unset.
fix exportoutputdir
This commit is contained in:
parent
c3144c2d0a
commit
5815b376b4
|
@ -56,7 +56,7 @@ func NewArtifact(remoteType string, format string, exportOutputPath string, vmNa
|
|||
var files []string
|
||||
var dir OutputDir
|
||||
var err error
|
||||
if remoteType != "" && format != "" && !skipExport {
|
||||
if remoteType != "" && !skipExport {
|
||||
dir = new(LocalOutputDir)
|
||||
dir.SetOutputDir(exportOutputPath)
|
||||
files, err = dir.ListFiles()
|
||||
|
|
|
@ -53,7 +53,7 @@ func (s *StepRegister) Cleanup(state multistep.StateBag) {
|
|||
}
|
||||
|
||||
if remoteDriver, ok := driver.(RemoteDriver); ok {
|
||||
if s.Format == "" || s.SkipExport {
|
||||
if s.SkipExport {
|
||||
ui.Say("Unregistering virtual machine...")
|
||||
if err := remoteDriver.Unregister(s.registeredPath); err != nil {
|
||||
ui.Error(fmt.Sprintf("Error unregistering VM: %s", err))
|
||||
|
@ -71,7 +71,7 @@ func (s *StepRegister) Cleanup(state multistep.StateBag) {
|
|||
if destroyed {
|
||||
break
|
||||
}
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,6 +238,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
dir = new(vmwcommon.LocalOutputDir)
|
||||
}
|
||||
|
||||
// The OutputDir will track remote esxi output; exportOutputPath preserves
|
||||
// the path to the output on the machine running Packer.
|
||||
exportOutputPath := b.config.OutputDir
|
||||
|
||||
if b.config.RemoteType != "" {
|
||||
b.config.OutputDir = b.config.VMName
|
||||
}
|
||||
|
@ -361,7 +365,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
SkipExport: b.config.SkipExport,
|
||||
VMName: b.config.VMName,
|
||||
OVFToolOptions: b.config.OVFToolOptions,
|
||||
OutputDir: b.config.OutputDir,
|
||||
OutputDir: exportOutputPath,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -384,7 +388,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
}
|
||||
|
||||
// Compile the artifact list
|
||||
return vmwcommon.NewArtifact(b.config.RemoteType, b.config.Format, b.config.OutputDir,
|
||||
return vmwcommon.NewArtifact(b.config.RemoteType, b.config.Format, exportOutputPath,
|
||||
b.config.VMName, b.config.SkipExport, b.config.KeepRegistered, state)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,12 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
default:
|
||||
dir = new(vmwcommon.LocalOutputDir)
|
||||
}
|
||||
if b.config.RemoteType != "" && b.config.Format != "" {
|
||||
|
||||
// The OutputDir will track remote esxi output; exportOutputPath preserves
|
||||
// the path to the output on the machine running Packer.
|
||||
exportOutputPath := b.config.OutputDir
|
||||
|
||||
if b.config.RemoteType != "" {
|
||||
b.config.OutputDir = b.config.VMName
|
||||
}
|
||||
dir.SetOutputDir(b.config.OutputDir)
|
||||
|
@ -159,6 +164,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
SkipExport: b.config.SkipExport,
|
||||
VMName: b.config.VMName,
|
||||
OVFToolOptions: b.config.OVFToolOptions,
|
||||
OutputDir: exportOutputPath,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -181,7 +187,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
}
|
||||
|
||||
// Artifact
|
||||
return vmwcommon.NewArtifact(b.config.RemoteType, b.config.Format, b.config.OutputDir,
|
||||
log.Printf("Generating artifact...")
|
||||
return vmwcommon.NewArtifact(b.config.RemoteType, b.config.Format, exportOutputPath,
|
||||
b.config.VMName, b.config.SkipExport, b.config.KeepRegistered, state)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue