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/constants"
|
2018-01-19 19:18:44 -05:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/packer"
|
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
|
|
|
|
}
|
|
|
|
|
2018-01-22 18:31:41 -05:00
|
|
|
func (s *StepSetCertificate) Run(_ 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) {
|
|
|
|
}
|