Commit d3ed1691 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #2351 from mitchellh/f-winrm-debug

builder/amazon: output WinRM password for debug mode [GH-2336]
parents 5c82ac28 b315e470
...@@ -19,6 +19,7 @@ import ( ...@@ -19,6 +19,7 @@ import (
// StepGetPassword reads the password from a Windows server and sets it // StepGetPassword reads the password from a Windows server and sets it
// on the WinRM config. // on the WinRM config.
type StepGetPassword struct { type StepGetPassword struct {
Debug bool
Comm *communicator.Config Comm *communicator.Config
Timeout time.Duration Timeout time.Duration
} }
...@@ -85,6 +86,13 @@ WaitLoop: ...@@ -85,6 +86,13 @@ WaitLoop:
} }
} }
} }
// In debug-mode, we output the password
if s.Debug {
ui.Message(fmt.Sprintf(
"Password (since debug is enabled): %s", s.Comm.WinRMPassword))
}
return multistep.ActionContinue return multistep.ActionContinue
} }
......
...@@ -119,6 +119,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -119,6 +119,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Tags: b.config.RunTags, Tags: b.config.RunTags,
}, },
&awscommon.StepGetPassword{ &awscommon.StepGetPassword{
Debug: b.config.PackerDebug,
Comm: &b.config.RunConfig.Comm, Comm: &b.config.RunConfig.Comm,
Timeout: b.config.WindowsPasswordTimeout, Timeout: b.config.WindowsPasswordTimeout,
}, },
......
...@@ -204,6 +204,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -204,6 +204,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Tags: b.config.RunTags, Tags: b.config.RunTags,
}, },
&awscommon.StepGetPassword{ &awscommon.StepGetPassword{
Debug: b.config.PackerDebug,
Comm: &b.config.RunConfig.Comm, Comm: &b.config.RunConfig.Comm,
Timeout: b.config.WindowsPasswordTimeout, Timeout: b.config.WindowsPasswordTimeout,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment