builder/vmware: downloadIso step, although not functional yet

This commit is contained in:
Mitchell Hashimoto 2013-06-09 21:50:15 -07:00
parent e39965e32a
commit a23500e0a4
3 changed files with 32 additions and 1 deletions

View File

@ -177,6 +177,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact {
rand.Seed(time.Now().UTC().UnixNano())
steps := []multistep.Step{
&stepDownloadISO{},
&stepPrepareOutputDir{},
&stepCreateDisk{},
&stepCreateVMX{},

View File

@ -21,6 +21,7 @@ type vmxTemplateData struct {
//
// Uses:
// config *config
// iso_path string
// ui packer.Ui
//
// Produces:
@ -29,6 +30,7 @@ type stepCreateVMX struct{}
func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction {
config := state["config"].(*config)
isoPath := state["iso_path"].(string)
ui := state["ui"].(packer.Ui)
ui.Say("Building and writing VMX file")
@ -37,7 +39,7 @@ func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction {
config.VMName,
config.GuestOSType,
config.DiskName,
config.ISOUrl,
isoPath,
}
var buf bytes.Buffer

View File

@ -0,0 +1,28 @@
package vmware
import (
"github.com/mitchellh/multistep"
"log"
)
// This step downloads the ISO specified.
//
// Uses:
// config *config
// ui packer.Ui
//
// Produces:
// iso_path string
type stepDownloadISO struct{}
func (stepDownloadISO) Run(state map[string]interface{}) multistep.StepAction {
config := state["config"].(*config)
log.Printf("Acquiring lock to download the ISO.")
state["iso_path"] = config.ISOUrl
return multistep.ActionContinue
}
func (stepDownloadISO) Cleanup(map[string]interface{}) {}