knife-vsphere icon indicating copy to clipboard operation
knife-vsphere copied to clipboard

Setting a winrm_user in knife.rb breaks linux bootstrapping in certain cases

Open jasons42 opened this issue 5 years ago • 0 comments

Versions:

  • Version of knife-vsphere: 2.2.1
  • Version of chef: 14.7.17

Scenario:

This is a bit of an edge case but the cause/fix is likely not obvious from a user perspective.

When using the vm clone feature to bootstrap a linux box, it will attempt to SSH to the node with the win_rm user instead of the ssh_user if the following things are true:

  • There is an ssh_user set in knife.rb
  • There is a winrm_user set in knife.rb
  • The user passes the ssh_user flag with a value matching knife.rb (e.g., both "root")

Problem logic

if get_config(:ssh_user).eql?(options[:ssh_user][:default]) &&
    !get_config(:winrm_user).eql?(options[:winrm_user][:default])
    config[:ssh_user] = get_config(:winrm_user)
end

Passing --bootstrap-protocol ssh does not resolve this issue.

jasons42 avatar Jan 18 '19 23:01 jasons42