2016-04-21 19:50:03 -04:00
|
|
|
package arm
|
|
|
|
|
|
|
|
import (
|
2018-01-22 18:32:33 -05:00
|
|
|
"context"
|
|
|
|
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
|
|
|
"github.com/hashicorp/packer/packer"
|
2020-11-17 19:31:03 -05:00
|
|
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
2016-04-21 19:50:03 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type StepSetCertificate struct {
|
|
|
|
config *Config
|
|
|
|
say func(message string)
|
|
|
|
error func(e error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewStepSetCertificate(config *Config, ui packer.Ui) *StepSetCertificate {
|
|
|
|
var step = &StepSetCertificate{
|
|
|
|
config: config,
|
|
|
|
say: func(message string) { ui.Say(message) },
|
|
|
|
error: func(e error) { ui.Error(e.Error()) },
|
|
|
|
}
|
|
|
|
|
|
|
|
return step
|
|
|
|
}
|
|
|
|
|
2019-03-29 11:50:02 -04:00
|
|
|
func (s *StepSetCertificate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
2016-04-21 19:50:03 -04:00
|
|
|
s.say("Setting the certificate's URL ...")
|
|
|
|
|
|
|
|
var winRMCertificateUrl = state.Get(constants.ArmCertificateUrl).(string)
|
|
|
|
s.config.tmpWinRMCertificateUrl = winRMCertificateUrl
|
|
|
|
|
|
|
|
return multistep.ActionContinue
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*StepSetCertificate) Cleanup(multistep.StateBag) {
|
|
|
|
}
|