builder/vmware: downloadIso step, although not functional yet
This commit is contained in:
parent
e39965e32a
commit
a23500e0a4
|
@ -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 {
|
||||||
//
|
//
|
||||||
// Uses:
|
// Uses:
|
||||||
// config *config
|
// config *config
|
||||||
|
// iso_path string
|
||||||
// ui packer.Ui
|
// ui packer.Ui
|
||||||
//
|
//
|
||||||
// Produces:
|
// Produces:
|
||||||
|
@ -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 {
|
||||||
config.VMName,
|
config.VMName,
|
||||||
config.GuestOSType,
|
config.GuestOSType,
|
||||||
config.DiskName,
|
config.DiskName,
|
||||||
config.ISOUrl,
|
isoPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
|
@ -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{}) {}
|
Loading…
Reference in New Issue