From 016b0985a6c0edaebd0ddfab2a40d47b8c6a2ed6 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 18 Sep 2018 16:05:49 +0200 Subject: [PATCH] builder/openstack: use config as a pointer so values could be set this commit will close #6712 --- builder/openstack/builder.go | 2 +- builder/openstack/step_add_image_members.go | 2 +- builder/openstack/step_allocate_ip.go | 4 ++-- builder/openstack/step_create_image.go | 2 +- builder/openstack/step_create_volume.go | 4 ++-- builder/openstack/step_detach_volume.go | 2 +- builder/openstack/step_get_password.go | 2 +- builder/openstack/step_key_pair.go | 4 ++-- builder/openstack/step_load_flavor.go | 2 +- builder/openstack/step_run_source_server.go | 4 ++-- builder/openstack/step_source_image_info.go | 2 +- builder/openstack/step_stop_server.go | 2 +- builder/openstack/step_update_image_visibility.go | 2 +- builder/openstack/step_wait_for_rackconnect.go | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index c39de991b..bf583d507 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -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) diff --git a/builder/openstack/step_add_image_members.go b/builder/openstack/step_add_image_members.go index e23e54588..24691dc2c 100644 --- a/builder/openstack/step_add_image_members.go +++ b/builder/openstack/step_add_image_members.go @@ -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 diff --git a/builder/openstack/step_allocate_ip.go b/builder/openstack/step_allocate_ip.go index 9570473fc..74bf63b75 100644 --- a/builder/openstack/step_allocate_ip.go +++ b/builder/openstack/step_allocate_ip.go @@ -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) diff --git a/builder/openstack/step_create_image.go b/builder/openstack/step_create_image.go index 260596ffb..a4bed481a 100644 --- a/builder/openstack/step_create_image.go +++ b/builder/openstack/step_create_image.go @@ -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) diff --git a/builder/openstack/step_create_volume.go b/builder/openstack/step_create_volume.go index a8083817f..4477c8869 100644 --- a/builder/openstack/step_create_volume.go +++ b/builder/openstack/step_create_volume.go @@ -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() diff --git a/builder/openstack/step_detach_volume.go b/builder/openstack/step_detach_volume.go index ff739e94d..70891862f 100644 --- a/builder/openstack/step_detach_volume.go +++ b/builder/openstack/step_detach_volume.go @@ -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() diff --git a/builder/openstack/step_get_password.go b/builder/openstack/step_get_password.go index 1572fb7a6..9459c1a19 100644 --- a/builder/openstack/step_get_password.go +++ b/builder/openstack/step_get_password.go @@ -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 diff --git a/builder/openstack/step_key_pair.go b/builder/openstack/step_key_pair.go index ba8b3516b..ccf1eaecf 100644 --- a/builder/openstack/step_key_pair.go +++ b/builder/openstack/step_key_pair.go @@ -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 diff --git a/builder/openstack/step_load_flavor.go b/builder/openstack/step_load_flavor.go index 8c331aa6a..00318c02a 100644 --- a/builder/openstack/step_load_flavor.go +++ b/builder/openstack/step_load_flavor.go @@ -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 diff --git a/builder/openstack/step_run_source_server.go b/builder/openstack/step_run_source_server.go index b86000248..facd5e53e 100644 --- a/builder/openstack/step_run_source_server.go +++ b/builder/openstack/step_run_source_server.go @@ -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 diff --git a/builder/openstack/step_source_image_info.go b/builder/openstack/step_source_image_info.go index 581f65a45..e6718f472 100644 --- a/builder/openstack/step_source_image_info.go +++ b/builder/openstack/step_source_image_info.go @@ -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 != "" { diff --git a/builder/openstack/step_stop_server.go b/builder/openstack/step_stop_server.go index 4a0f867b0..e3c50141b 100644 --- a/builder/openstack/step_stop_server.go +++ b/builder/openstack/step_stop_server.go @@ -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 diff --git a/builder/openstack/step_update_image_visibility.go b/builder/openstack/step_update_image_visibility.go index 8d9a3bc7c..82396c1b9 100644 --- a/builder/openstack/step_update_image_visibility.go +++ b/builder/openstack/step_update_image_visibility.go @@ -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 diff --git a/builder/openstack/step_wait_for_rackconnect.go b/builder/openstack/step_wait_for_rackconnect.go index 6cbe2ed0e..279aa3cc5 100644 --- a/builder/openstack/step_wait_for_rackconnect.go +++ b/builder/openstack/step_wait_for_rackconnect.go @@ -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)