Skip to content

Commit

Permalink
Verify windows password is part of the provided options
Browse files Browse the repository at this point in the history
WinRM config data is passed in the user data to the AWS api.
Part of this includes an optional winrm user creation.
The user can only be created if a password is passed to the gem.
it cannot wait for the password from AWS, as this is only available
after the user data is paased and the server created
  • Loading branch information
Topher Cullen committed Apr 13, 2017
1 parent f427702 commit 1131c31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/chef/knife/ec2_server_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def eip_scope
def ssl_config_user_data
user_related_commands = ""
winrm_user = locate_config_value(:winrm_user).split("\\")
if (winrm_user[0] == ".") || (winrm_user[0] == "") ||(winrm_user.length == 1)
if (winrm_user[0] == ".") || (winrm_user[0] == "") ||(winrm_user.length == 1) && locate_config_value(:winrm_password)
user_related_commands = <<-EOH
net user /add #{locate_config_value(:winrm_user).delete('.\\')} #{windows_password} #{@allow_long_password};
net localgroup Administrators /add #{locate_config_value(:winrm_user).delete('.\\')};
Expand Down

0 comments on commit 1131c31

Please sign in to comment.