2018-04-05 18:24:54 -04:00
|
|
|
package arm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2018-09-10 19:48:42 -04:00
|
|
|
commonhelper "github.com/hashicorp/packer/helper/common"
|
2018-04-05 18:24:54 -04:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2018-08-10 17:25:14 -04:00
|
|
|
"github.com/hashicorp/packer/packer"
|
2018-04-05 18:24:54 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type StepSaveWinRMPassword struct {
|
2018-04-16 14:51:04 -04:00
|
|
|
Password string
|
|
|
|
BuildName string
|
2018-04-05 18:24:54 -04:00
|
|
|
}
|
|
|
|
|
2019-03-29 11:50:02 -04:00
|
|
|
func (s *StepSaveWinRMPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
2018-04-05 18:24:54 -04:00
|
|
|
// store so that we can access this later during provisioning
|
2018-09-10 19:48:42 -04:00
|
|
|
commonhelper.SetSharedState("winrm_password", s.Password, s.BuildName)
|
2018-08-10 17:25:14 -04:00
|
|
|
packer.LogSecretFilter.Set(s.Password)
|
2018-04-05 18:24:54 -04:00
|
|
|
return multistep.ActionContinue
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StepSaveWinRMPassword) Cleanup(multistep.StateBag) {
|
2018-09-10 19:48:42 -04:00
|
|
|
commonhelper.RemoveSharedStateFile("winrm_password", s.BuildName)
|
2018-04-05 18:24:54 -04:00
|
|
|
}
|