github.com/mitchellh/packer@v1.3.2/builder/azure/arm/step_set_certificate.go (about)

     1  package arm
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/hashicorp/packer/builder/azure/common/constants"
     7  	"github.com/hashicorp/packer/helper/multistep"
     8  	"github.com/hashicorp/packer/packer"
     9  )
    10  
    11  type StepSetCertificate struct {
    12  	config *Config
    13  	say    func(message string)
    14  	error  func(e error)
    15  }
    16  
    17  func NewStepSetCertificate(config *Config, ui packer.Ui) *StepSetCertificate {
    18  	var step = &StepSetCertificate{
    19  		config: config,
    20  		say:    func(message string) { ui.Say(message) },
    21  		error:  func(e error) { ui.Error(e.Error()) },
    22  	}
    23  
    24  	return step
    25  }
    26  
    27  func (s *StepSetCertificate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
    28  	s.say("Setting the certificate's URL ...")
    29  
    30  	var winRMCertificateUrl = state.Get(constants.ArmCertificateUrl).(string)
    31  	s.config.tmpWinRMCertificateUrl = winRMCertificateUrl
    32  
    33  	return multistep.ActionContinue
    34  }
    35  
    36  func (*StepSetCertificate) Cleanup(multistep.StateBag) {
    37  }