cloudstack: Print instance password if debug mode

This commit is contained in:
Rickard von Essen 2017-07-18 21:05:27 +02:00
parent fc964bfab2
commit 89dcc93f1c
2 changed files with 10 additions and 2 deletions

View File

@ -72,7 +72,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
PrivateKeyFile: b.config.Comm.SSHPrivateKey,
},
&stepCreateInstance{
Ctx: b.config.ctx,
Debug: b.config.PackerDebug,
Ctx: b.config.ctx,
},
&stepSetupNetworking{},
&communicator.StepConnect{

View File

@ -22,7 +22,8 @@ type userDataTemplateData struct {
// stepCreateInstance represents a Packer build step that creates CloudStack instances.
type stepCreateInstance struct {
Ctx interpolate.Context
Debug bool
Ctx interpolate.Context
}
// Run executes the Packer build step that creates a CloudStack instance.
@ -115,6 +116,12 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
ui.Message("Instance has been created!")
// In debug-mode, we output the password
if s.Debug {
ui.Message(fmt.Sprintf(
"Password (since debug is enabled) \"%s\"", instance.Password))
}
// Set the auto generated password if a password was not explicitly configured.
switch config.Comm.Type {
case "ssh":