Skip to content

Commit

Permalink
Ensure build.password parameter gets set to generated password (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-richardson authored Mar 1, 2023
1 parent a37666c commit a95d663
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions builder/azure/arm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,9 @@ func setUserNamePassword(c *Config) error {
}

if c.Comm.Type == "ssh" {
if c.Comm.SSHPassword == "" {
c.Comm.SSHPassword = c.Password
}
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions builder/azure/arm/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func TestConfigUserNameOverride(t *testing.T) {
if c.Password != c.tmpAdminPassword {
t.Errorf("Expected 'Password' to be set to generated password, but found %q!", c.Password)
}
if c.Comm.SSHPassword != "" {
t.Errorf("Expected 'c.Comm.SSHPassword' to be empty, but found %q!", c.Comm.SSHPassword)
if c.Comm.SSHPassword != c.tmpAdminPassword {
t.Errorf("Expected 'c.Comm.SSHPassword' to set to generated password, but found %q!", c.Comm.SSHPassword)
}
if c.UserName != "override_username" {
t.Errorf("Expected 'UserName' to be set to 'override_username', but found %q!", c.UserName)
Expand Down

0 comments on commit a95d663

Please sign in to comment.