OpenStack builder store WinRM password for provisioners to use
This commit is contained in:
parent
c0e37e6045
commit
c0ee859559
|
@ -8,6 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
|
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
|
||||||
|
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"github.com/hashicorp/packer/helper/communicator"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -19,6 +20,7 @@ import (
|
||||||
type StepGetPassword struct {
|
type StepGetPassword struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
Comm *communicator.Config
|
Comm *communicator.Config
|
||||||
|
BuildName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
|
@ -76,7 +78,12 @@ func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) mul
|
||||||
"Password (since debug is enabled) \"%s\"", s.Comm.WinRMPassword))
|
"Password (since debug is enabled) \"%s\"", s.Comm.WinRMPassword))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commonhelper.SetSharedState("winrm_password", s.Comm.WinRMPassword, s.BuildName)
|
||||||
|
packer.LogSecretFilter.Set(s.Comm.WinRMPassword)
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetPassword) Cleanup(multistep.StateBag) {}
|
func (s *StepGetPassword) Cleanup(multistep.StateBag) {
|
||||||
|
commonhelper.RemoveSharedStateFile("winrm_password", s.BuildName)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue