fix: remove pointer when gets vm from the state
This commit is contained in:
parent
9d6c4a8e5b
commit
987b4148e1
|
@ -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}}"
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue