Closed matt-richardson closed 1 year ago
Ping @JenGoldstrich, as you worked with me on the PR to get the SSH support in.
Hey @matt-richardson thanks for reporting this issue,
I would change this slightly as just above your suggest change we set c.Password to c.Comm.SSHPassword if the user passed one in.
I would do something like
if c.Comm.Type == "ssh" {
if c.Comm.SSHPassword == "" {
c.Comm.SSHPassword = c.Password
}
return nil
}
so that we don't overwrite a pre-set SSH Password.
One important caveat is I'm curious how this currently works on Linux, the code you linked appears to be called on Linux and Windows builds, so I don't think this issue is exclusive to Windows, it'll be worth testing this on Linux VMs to see if they set a default password when not setting an ssh password
with regards to the unit test I think we just didn't set an ssh password if users didn't provide one before, so its just checking if you don't set one it doesn't get set, I think the assertion makes sense with the current code but changing it would be fine.
If you wanna open a PR for this I can try and do some before/after tests with Linux builds to confirm this doesn't break anything.
@JenGoldstrich - PR 268 raised :smile:
This issue has been synced to JIRA for planning.
JIRA ID: HPR-997
Overview of the Issue
When using the new SSH on Windows functionality in 1.4.0, it doesn't appear to be setting
build.Password
(that is recommend here).I've tracked it down to the setUserNamePassword function in
config.go
.If I change
to
Then it works, but it fails the TestConfigUserNameOverride test in
config_test.go
. Unfortunately, the test doesn't say why the password should be empty, so I'm not sure of the ramifications of changing that test.Reproduction Steps
Use the packer scripts below.
Output
Expected output
Plugin and Packer version
From
packer version
:Packer v1.8.0
Plugin version1.4.0
Simplified Packer Buildfile
scripts/userdata.ps1
Operating system and Environment details
OS, Architecture, and any other information you can provide about the environment.
Host: macOS 13.1, arm64. Guest: Windows 2016, x86.
Log Fragments and crash.log files
Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.
Set the env var
PACKER_LOG=1
for maximum log detail.