Commit a23500e0 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/vmware: downloadIso step, although not functional yet

parent e39965e3
...@@ -177,6 +177,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact { ...@@ -177,6 +177,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact {
rand.Seed(time.Now().UTC().UnixNano()) rand.Seed(time.Now().UTC().UnixNano())
steps := []multistep.Step{ steps := []multistep.Step{
&stepDownloadISO{},
&stepPrepareOutputDir{}, &stepPrepareOutputDir{},
&stepCreateDisk{}, &stepCreateDisk{},
&stepCreateVMX{}, &stepCreateVMX{},
......
...@@ -21,6 +21,7 @@ type vmxTemplateData struct { ...@@ -21,6 +21,7 @@ type vmxTemplateData struct {
// //
// Uses: // Uses:
// config *config // config *config
// iso_path string
// ui packer.Ui // ui packer.Ui
// //
// Produces: // Produces:
...@@ -29,6 +30,7 @@ type stepCreateVMX struct{} ...@@ -29,6 +30,7 @@ type stepCreateVMX struct{}
func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction { func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction {
config := state["config"].(*config) config := state["config"].(*config)
isoPath := state["iso_path"].(string)
ui := state["ui"].(packer.Ui) ui := state["ui"].(packer.Ui)
ui.Say("Building and writing VMX file") ui.Say("Building and writing VMX file")
...@@ -37,7 +39,7 @@ func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction { ...@@ -37,7 +39,7 @@ func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction {
config.VMName, config.VMName,
config.GuestOSType, config.GuestOSType,
config.DiskName, config.DiskName,
config.ISOUrl, isoPath,
} }
var buf bytes.Buffer var buf bytes.Buffer
......
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{}) {}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment