pas data into provisioners well

This commit is contained in:
Megan Marsh 2019-07-11 12:10:57 -07:00
parent ee336e6d12
commit 601007e3e2
6 changed files with 15 additions and 14 deletions

View File

@ -91,16 +91,13 @@ WaitLoop:
"Password (since debug is enabled): %s", s.Comm.WinRMPassword))
}
// store so that we can access this later during provisioning
commonhelper.SetSharedState("winrm_password", s.Comm.WinRMPassword, s.BuildName)
state.Put("winrm_password", s.Comm.WinRMPassword)
packer.LogSecretFilter.Set(s.Comm.WinRMPassword)
return multistep.ActionContinue
}
func (s *StepGetPassword) Cleanup(multistep.StateBag) {
commonhelper.RemoveSharedStateFile("winrm_password", s.BuildName)
}
func (s *StepGetPassword) Cleanup(multistep.StateBag) {}
func (s *StepGetPassword) waitForPassword(ctx context.Context, state multistep.StateBag) (string, error) {
ec2conn := state.Get("ec2").(*ec2.EC2)

View File

@ -601,7 +601,6 @@ func setRuntimeValues(c *Config) {
c.tmpAdminPassword = tempName.AdminPassword
// store so that we can access this later during provisioning
commonhelper.SetSharedState("winrm_password", c.tmpAdminPassword, c.PackerConfig.PackerBuildName)
packer.LogSecretFilter.Set(c.tmpAdminPassword)
c.tmpCertificatePassword = tempName.CertificatePassword

View File

@ -15,11 +15,9 @@ type StepSaveWinRMPassword struct {
func (s *StepSaveWinRMPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
// store so that we can access this later during provisioning
commonhelper.SetSharedState("winrm_password", s.Password, s.BuildName)
state.Put("winrm_password", s.Password)
packer.LogSecretFilter.Set(s.Password)
return multistep.ActionContinue
}
func (s *StepSaveWinRMPassword) Cleanup(multistep.StateBag) {
commonhelper.RemoveSharedStateFile("winrm_password", s.BuildName)
}
func (s *StepSaveWinRMPassword) Cleanup(multistep.StateBag) {}

View File

@ -119,7 +119,6 @@ func (s *StepCreateWindowsPassword) Run(ctx context.Context, state multistep.Sta
}
state.Put("winrm_password", data.password)
commonhelper.SetSharedState("winrm_password", data.password, c.PackerConfig.PackerBuildName)
packer.LogSecretFilter.Set(data.password)
return multistep.ActionContinue

View File

@ -52,7 +52,7 @@ func (s *stepGetDefaultCredentials) Run(ctx context.Context, state multistep.Sta
}
// store so that we can access this later during provisioning
commonhelper.SetSharedState("winrm_password", s.Comm.WinRMPassword, s.BuildName)
state.Put("winrm_password", s.Comm.WinRMPassword)
packer.LogSecretFilter.Set(s.Comm.WinRMPassword)
return multistep.ActionContinue
}

View File

@ -38,6 +38,11 @@ func (p *provisioner) Prepare(configs ...interface{}) (err error) {
return
}
type ProvisionerProvisionArgs struct {
GeneratedData *packer.ProvisionHookData
StreamID uint32
}
func (p *provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData *packer.ProvisionHookData) error {
nextId := p.mux.NextId()
server := newServerWithMux(p.mux, nextId)
@ -59,14 +64,17 @@ func (p *provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C
}
}()
return p.client.Call("Provisioner.Provision", nextId, new(interface{}))
args := &ProvisionerProvisionArgs{generatedData, nextId}
return p.client.Call("Provisioner.Provision", args, new(interface{}))
}
func (p *ProvisionerServer) Prepare(args *ProvisionerPrepareArgs, reply *interface{}) error {
return p.p.Prepare(args.Configs...)
}
func (p *ProvisionerServer) Provision(streamId uint32, reply *interface{}, generatedData *packer.ProvisionHookData) error {
func (p *ProvisionerServer) Provision(args *ProvisionerProvisionArgs, reply *interface{}) error {
streamId := args.StreamID
generatedData := args.GeneratedData
client, err := newClientWithMux(p.mux, streamId)
if err != nil {
return NewBasicError(err)