builder/openstack: use config as a pointer so values could be set

this commit will close #6712
This commit is contained in:
Adrien Delorme 2018-09-18 16:05:49 +02:00
parent b328d3569d
commit 016b0985a6
14 changed files with 18 additions and 18 deletions

View File

@ -73,7 +73,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
// Setup the state bag and initial state for the steps
state := new(multistep.BasicStateBag)
state.Put("config", b.config)
state.Put("config", &b.config)
state.Put("hook", hook)
state.Put("ui", ui)

View File

@ -14,7 +14,7 @@ type stepAddImageMembers struct{}
func (s *stepAddImageMembers) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
imageId := state.Get("image").(string)
ui := state.Get("ui").(packer.Ui)
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
if len(config.ImageMembers) == 0 {
return multistep.ActionContinue

View File

@ -18,7 +18,7 @@ type StepAllocateIp struct {
func (s *StepAllocateIp) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
server := state.Get("server").(*servers.Server)
// We need the v2 compute client
@ -138,7 +138,7 @@ func (s *StepAllocateIp) Run(_ context.Context, state multistep.StateBag) multis
}
func (s *StepAllocateIp) Cleanup(state multistep.StateBag) {
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
instanceIP := state.Get("access_ip").(*floatingips.FloatingIP)

View File

@ -20,7 +20,7 @@ type stepCreateImage struct {
}
func (s *stepCreateImage) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
server := state.Get("server").(*servers.Server)
ui := state.Get("ui").(packer.Ui)

View File

@ -24,7 +24,7 @@ func (s *StepCreateVolume) Run(_ context.Context, state multistep.StateBag) mult
return multistep.ActionContinue
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
sourceImage := state.Get("source_image").(string)
@ -92,7 +92,7 @@ func (s *StepCreateVolume) Cleanup(state multistep.StateBag) {
return
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
blockStorageClient, err := config.blockStorageV3Client()

View File

@ -19,7 +19,7 @@ func (s *StepDetachVolume) Run(_ context.Context, state multistep.StateBag) mult
return multistep.ActionContinue
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
blockStorageClient, err := config.blockStorageV3Client()

View File

@ -22,7 +22,7 @@ type StepGetPassword struct {
}
func (s *StepGetPassword) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
// Skip if we're not using winrm

View File

@ -57,7 +57,7 @@ func (s *StepKeyPair) Run(_ context.Context, state multistep.StateBag) multistep
return multistep.ActionContinue
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
// We need the v2 compute client
computeClient, err := config.computeV2Client()
@ -169,7 +169,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
return
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
// We need the v2 compute client

View File

@ -18,7 +18,7 @@ type StepLoadFlavor struct {
}
func (s *StepLoadFlavor) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
// We need the v2 compute client

View File

@ -30,7 +30,7 @@ type StepRunSourceServer struct {
}
func (s *StepRunSourceServer) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
flavor := state.Get("flavor_id").(string)
sourceImage := state.Get("source_image").(string)
ui := state.Get("ui").(packer.Ui)
@ -148,7 +148,7 @@ func (s *StepRunSourceServer) Cleanup(state multistep.StateBag) {
return
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
// We need the v2 compute client

View File

@ -19,7 +19,7 @@ type StepSourceImageInfo struct {
}
func (s *StepSourceImageInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui)
if s.SourceImage != "" {

View File

@ -14,7 +14,7 @@ type StepStopServer struct{}
func (s *StepStopServer) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
server := state.Get("server").(*servers.Server)
// We need the v2 compute client

View File

@ -14,7 +14,7 @@ type stepUpdateImageVisibility struct{}
func (s *stepUpdateImageVisibility) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
imageId := state.Get("image").(string)
ui := state.Get("ui").(packer.Ui)
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
if config.ImageVisibility == "" {
return multistep.ActionContinue

View File

@ -19,7 +19,7 @@ func (s *StepWaitForRackConnect) Run(_ context.Context, state multistep.StateBag
return multistep.ActionContinue
}
config := state.Get("config").(Config)
config := state.Get("config").(*Config)
server := state.Get("server").(*servers.Server)
ui := state.Get("ui").(packer.Ui)