'configuration_parameters' in clone builder

This commit is contained in:
Michael Kuzmin 2018-05-05 01:48:16 +03:00
parent aedfab264f
commit 0b4729c9e4
5 changed files with 11 additions and 9 deletions

View File

@ -2,11 +2,11 @@ package clone
import (
packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/helper/communicator"
)
type Builder struct {
@ -26,7 +26,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("config", b.config)
state.Put("comm", &b.config.Comm)
state.Put("hook", hook)
state.Put("ui", ui)
@ -43,6 +42,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&StepConfigureHardware{
config: &b.config.HardwareConfig,
},
&common.StepConfigParams{
Config: &b.config.ConfigParamsConfig,
},
)
if b.config.Comm.Type != "none" {
@ -72,7 +74,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
)
// Run!
b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui)
b.runner.Run(state)

View File

@ -18,6 +18,7 @@ type Config struct {
common.ShutdownConfig `mapstructure:",squash"`
CreateSnapshot bool `mapstructure:"create_snapshot"`
ConvertToTemplate bool `mapstructure:"convert_to_template"`
common.ConfigParamsConfig `mapstructure:",squash"`
ctx interpolate.Context
}

View File

@ -1,4 +1,4 @@
package iso
package common
import (
"github.com/hashicorp/packer/packer"

View File

@ -39,7 +39,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&StepCreateVM{
Config: &b.config.CreateConfig,
},
&StepConfigParams{
&common.StepConfigParams{
Config: &b.config.ConfigParamsConfig,
},
)

View File

@ -22,7 +22,7 @@ type Config struct {
CreateConfig `mapstructure:",squash"`
CDRomConfig `mapstructure:",squash"`
FloppyConfig `mapstructure:",squash"`
ConfigParamsConfig `mapstructure:",squash"`
common.ConfigParamsConfig `mapstructure:",squash"`
ctx interpolate.Context
}