summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2017-01-17 18:55:52 +0000
committerGitHub <noreply@github.com>2017-01-17 18:55:52 +0000
commit9ba9c3cff10645b1448e424be3a61816aa96f384 (patch)
tree1edebeed02720aa993201392b100ef1bd346028e
parent51d1b7e2003bee7c03f363866743abd6c9b6750d (diff)
parent24d230b09a68c8b6857d060b398e779a23ba80bc (diff)
downloadchef-9ba9c3cff10645b1448e424be3a61816aa96f384.tar.gz
Merge pull request #5726 from higanworks/compatible_with_net-ssh4
pass true as 2nd args for Net::SSH.configuration_for by default.
-rw-r--r--lib/chef/knife/ssh.rb2
-rw-r--r--spec/unit/knife/ssh_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index f827aca280..53801afffd 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -232,7 +232,7 @@ class Chef
# @param user [String] Optional username for this session.
# @return [Hash<Symbol, Object>]
def session_options(host, port, user = nil)
- ssh_config = Net::SSH.configuration_for(host)
+ ssh_config = Net::SSH.configuration_for(host, true)
{}.tap do |opts|
# Chef::Config[:knife][:ssh_user] is parsed in #configure_user and written to config[:ssh_user]
opts[:user] = user || config[:ssh_user] || ssh_config[:user]
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 44a133d858..9263a0b8e5 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -190,7 +190,7 @@ describe Chef::Knife::Ssh do
before :each do
@knife.instance_variable_set(:@longest, 0)
ssh_config = { :timeout => 50, :user => "locutus", :port => 23 }
- allow(Net::SSH).to receive(:configuration_for).with("the.b.org").and_return(ssh_config)
+ allow(Net::SSH).to receive(:configuration_for).with("the.b.org", true).and_return(ssh_config)
end
it "uses the port from an ssh config file" do