2016-04-21 19:50:03 -04:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
2016-05-06 23:32:18 -04:00
|
|
|
// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
|
2016-04-21 19:50:03 -04:00
|
|
|
|
|
|
|
package arm
|
|
|
|
|
|
|
|
import (
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/builder/azure/common"
|
|
|
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
2016-05-18 20:25:57 -04:00
|
|
|
"github.com/mitchellh/multistep"
|
2016-04-21 19:50:03 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func processInterruptibleResult(
|
|
|
|
result common.InterruptibleTaskResult, sayError func(error), state multistep.StateBag) multistep.StepAction {
|
|
|
|
if result.IsCancelled {
|
|
|
|
return multistep.ActionHalt
|
|
|
|
}
|
|
|
|
|
|
|
|
return processStepResult(result.Err, sayError, state)
|
|
|
|
}
|
|
|
|
|
|
|
|
func processStepResult(
|
|
|
|
err error, sayError func(error), state multistep.StateBag) multistep.StepAction {
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
state.Put(constants.Error, err)
|
|
|
|
sayError(err)
|
|
|
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
}
|
|
|
|
|
|
|
|
return multistep.ActionContinue
|
|
|
|
|
|
|
|
}
|