Skip to content

Commit

Permalink
Merge pull request #112 from ClogenyTechnologies/sid/winrm-backward-s…
Browse files Browse the repository at this point in the history
…upport-comments

Added changes to remove check for local domain for winrm-s use
  • Loading branch information
Adam Edwards committed Oct 21, 2014
2 parents b0cf84c + f33cf9b commit 83e022f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/chef/knife/winrm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ def session_from_list(list)
session_opts[:operation_timeout] = 1800 # 30 min OperationTimeout for long bootstraps fix for KNIFE_WINDOWS-8

## If you have a \\ in your name you need to use NTLM domain authentication
username_components = session_opts[:user].split("\\")
username_contains_domain = username_components.length.eql?(2)
username_contains_domain = session_opts[:user].split("\\").length.eql?(2)

if username_contains_domain
# We cannot use basic_auth for domain authentication
Expand All @@ -158,7 +157,7 @@ def session_from_list(list)
else
session_opts[:transport] = (Chef::Config[:knife][:winrm_transport] || config[:winrm_transport]).to_sym

if Chef::Platform.windows? && session_opts[:transport] == :plaintext && username_contains_domain && username_components[0] != "."
if Chef::Platform.windows? && session_opts[:transport] == :plaintext && username_contains_domain
ui.warn("Switching to Negotiate authentication, Basic does not support Domain Authentication")
# windows - force only encrypted communication
require 'winrm-s'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/knife/winrm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
it "should skip winrm monkey patched for windows" do
@winrm.config[:winrm_user] = ".\\testuser"
allow(Chef::Platform).to receive(:windows?).and_return(true)
expect(@winrm).to_not receive(:require).with('winrm-s')
expect(@winrm).to receive(:require).with('winrm-s')

exit_code = @winrm.run
end
Expand Down

0 comments on commit 83e022f

Please sign in to comment.