github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/builder/azure/arm/step.go (about)

     1  // Copyright (c) Microsoft Corporation. All rights reserved.
     2  // Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
     3  
     4  package arm
     5  
     6  import (
     7  	"github.com/mitchellh/multistep"
     8  	"github.com/mitchellh/packer/builder/azure/common"
     9  	"github.com/mitchellh/packer/builder/azure/common/constants"
    10  )
    11  
    12  func processInterruptibleResult(
    13  	result common.InterruptibleTaskResult, sayError func(error), state multistep.StateBag) multistep.StepAction {
    14  	if result.IsCancelled {
    15  		return multistep.ActionHalt
    16  	}
    17  
    18  	return processStepResult(result.Err, sayError, state)
    19  }
    20  
    21  func processStepResult(
    22  	err error, sayError func(error), state multistep.StateBag) multistep.StepAction {
    23  
    24  	if err != nil {
    25  		state.Put(constants.Error, err)
    26  		sayError(err)
    27  
    28  		return multistep.ActionHalt
    29  	}
    30  
    31  	return multistep.ActionContinue
    32  
    33  }