From 987b4148e161c9e1313ec90ad2ae226fced5e122 Mon Sep 17 00:00:00 2001 From: Marin Salinas Date: Tue, 5 Mar 2019 13:31:28 -0600 Subject: [PATCH] fix: remove pointer when gets vm from the state --- builder/osc/bsu/builder_acc_test.go | 4 ++-- builder/osc/bsu/step_create_omi.go | 2 +- builder/osc/common/step_cleanup_volumes.go | 6 +++--- builder/osc/common/step_stop_bsu_backed_vm.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/builder/osc/bsu/builder_acc_test.go b/builder/osc/bsu/builder_acc_test.go index 7a2de6611..f31f8c058 100644 --- a/builder/osc/bsu/builder_acc_test.go +++ b/builder/osc/bsu/builder_acc_test.go @@ -46,9 +46,9 @@ const testBuilderAccBasic = ` "builders": [{ "type": "test", "region": "eu-west-2", - "vm_type": "m3.medium", + "vm_type": "t2.micro", "source_omi": "ami-46260446", - "ssh_username": "ubuntu", + "ssh_username": "outscale", "omi_name": "packer-test {{timestamp}}" }] } diff --git a/builder/osc/bsu/step_create_omi.go b/builder/osc/bsu/step_create_omi.go index 8c6d73aa0..2ccd538e3 100644 --- a/builder/osc/bsu/step_create_omi.go +++ b/builder/osc/bsu/step_create_omi.go @@ -18,7 +18,7 @@ type stepCreateOMI struct { func (s *stepCreateOMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) oapiconn := state.Get("oapi").(*oapi.Client) - vm := state.Get("vm").(*oapi.Vm) + vm := state.Get("vm").(oapi.Vm) ui := state.Get("ui").(packer.Ui) // Create the image diff --git a/builder/osc/common/step_cleanup_volumes.go b/builder/osc/common/step_cleanup_volumes.go index e49afe91d..a65b1325d 100644 --- a/builder/osc/common/step_cleanup_volumes.go +++ b/builder/osc/common/step_cleanup_volumes.go @@ -25,12 +25,12 @@ func (s *StepCleanupVolumes) Run(_ context.Context, state multistep.StateBag) mu func (s *StepCleanupVolumes) Cleanup(state multistep.StateBag) { oapiconn := state.Get("oapi").(*oapi.Client) vmRaw := state.Get("vm") - var vm *oapi.Vm + var vm oapi.Vm if vmRaw != nil { - vm = vmRaw.(*oapi.Vm) + vm = vmRaw.(oapi.Vm) } ui := state.Get("ui").(packer.Ui) - if vm == nil { + if vm.VmId == "" { ui.Say("No volumes to clean up, skipping") return } diff --git a/builder/osc/common/step_stop_bsu_backed_vm.go b/builder/osc/common/step_stop_bsu_backed_vm.go index d3b987ac6..02076d35d 100644 --- a/builder/osc/common/step_stop_bsu_backed_vm.go +++ b/builder/osc/common/step_stop_bsu_backed_vm.go @@ -18,7 +18,7 @@ type StepStopBSUBackedVm struct { func (s *StepStopBSUBackedVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { oapiconn := state.Get("oapi").(*oapi.Client) - vm := state.Get("vm").(*oapi.Vm) + vm := state.Get("vm").(oapi.Vm) ui := state.Get("ui").(packer.Ui) // Skip when it is a spot vm