builer/triton: pass config as a pointer so values could be set
This commit is contained in:
parent
22d3e9b5c4
commit
b328d3569d
|
@ -54,7 +54,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
}
|
||||
|
||||
state := new(multistep.BasicStateBag)
|
||||
state.Put("config", b.config)
|
||||
state.Put("config", &b.config)
|
||||
state.Put("debug", b.config.PackerDebug)
|
||||
state.Put("driver", driver)
|
||||
state.Put("hook", hook)
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
func testConfig(t *testing.T) Config {
|
||||
return Config{
|
||||
func testConfig(t *testing.T) *Config {
|
||||
return &Config{
|
||||
AccessConfig: testAccessConfig(),
|
||||
SourceMachineConfig: testSourceMachineConfig(t),
|
||||
TargetImageConfig: testTargetImageConfig(t),
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
type StepCreateImageFromMachine struct{}
|
||||
|
||||
func (s *StepCreateImageFromMachine) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
config := state.Get("config").(Config)
|
||||
config := state.Get("config").(*Config)
|
||||
driver := state.Get("driver").(Driver)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
|
@ -23,7 +23,7 @@ func (s *StepCreateImageFromMachine) Run(_ context.Context, state multistep.Stat
|
|||
|
||||
ui.Say("Creating image from source machine...")
|
||||
|
||||
imageId, err := driver.CreateImageFromMachine(machineId, config)
|
||||
imageId, err := driver.CreateImageFromMachine(machineId, *config)
|
||||
if err != nil {
|
||||
state.Put("error", fmt.Errorf("Problem creating image from machine: %s", err))
|
||||
return multistep.ActionHalt
|
||||
|
|
|
@ -14,13 +14,13 @@ import (
|
|||
type StepCreateSourceMachine struct{}
|
||||
|
||||
func (s *StepCreateSourceMachine) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
config := state.Get("config").(Config)
|
||||
config := state.Get("config").(*Config)
|
||||
driver := state.Get("driver").(Driver)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
if !config.MachineImageFilters.Empty() {
|
||||
ui.Say("Selecting an image based on search criteria")
|
||||
imageId, err := driver.GetImage(config)
|
||||
imageId, err := driver.GetImage(*config)
|
||||
if err != nil {
|
||||
state.Put("error", fmt.Errorf("Problem selecting an image based on an search criteria: %s", err))
|
||||
return multistep.ActionHalt
|
||||
|
@ -29,7 +29,7 @@ func (s *StepCreateSourceMachine) Run(_ context.Context, state multistep.StateBa
|
|||
config.MachineImage = imageId
|
||||
}
|
||||
|
||||
machineId, err := driver.CreateMachine(config)
|
||||
machineId, err := driver.CreateMachine(*config)
|
||||
if err != nil {
|
||||
state.Put("error", fmt.Errorf("Problem creating source machine: %s", err))
|
||||
return multistep.ActionHalt
|
||||
|
|
Loading…
Reference in New Issue