diff options
author | Grant Ridder <shortdudey123@gmail.com> | 2017-02-21 15:12:17 -0800 |
---|---|---|
committer | Grant Ridder <shortdudey123@gmail.com> | 2017-02-21 16:16:46 -0800 |
commit | 03e0bbe62ecdbcd6701544c638bf5e60c3c02885 (patch) | |
tree | 37632d2d101faa7bdfa8c68b18b466dfb2e1ab54 | |
parent | 97395b8b81949a3d0c648031d71c17fbf313a28a (diff) | |
download | chef-03e0bbe62ecdbcd6701544c638bf5e60c3c02885.tar.gz |
Fix spec testing for ssh_gateway_identity option
Signed-off-by: Grant Ridder <shortdudey123@gmail.com>
-rw-r--r-- | .bundle/config | 2 | ||||
-rw-r--r-- | lib/chef/knife/ssh.rb | 9 | ||||
-rw-r--r-- | spec/functional/knife/ssh_spec.rb | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/.bundle/config b/.bundle/config index e520135ebc..2bf84ac862 100644 --- a/.bundle/config +++ b/.bundle/config @@ -1,2 +1,4 @@ --- BUNDLE_FROZEN: "1" +BUNDLE_PATH: ".bundle" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 825160756f..cfe85ee156 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -94,8 +94,7 @@ class Chef option :ssh_gateway_identity, :long => "--ssh-gateway-identity SSH_GATEWAY_IDENTITY", - :description => "The SSH identity file used for gateway authentication", - :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key.strip } + :description => "The SSH identity file used for gateway authentication" option :forward_agent, :short => "-A", @@ -554,6 +553,11 @@ class Chef config[:ssh_identity_file] = get_stripped_unfrozen_value(config[:ssh_identity_file] || config[:identity_file] || Chef::Config[:knife][:ssh_identity_file]) end + def configure_ssh_gateway_identity + # config[:identity_file] is DEPRECATED in favor of :ssh_identity_file + config[:ssh_gateway_identity] = get_stripped_unfrozen_value(config[:ssh_gateway_identity] || Chef::Config[:knife][:ssh_gateway_identity]) + end + def run @longest = 0 @@ -561,6 +565,7 @@ class Chef configure_password @password = config[:ssh_password] if config[:ssh_password] configure_ssh_identity_file + configure_ssh_gateway_identity configure_gateway configure_session diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb index dae4029946..cfe28b862f 100644 --- a/spec/functional/knife/ssh_spec.rb +++ b/spec/functional/knife/ssh_spec.rb @@ -254,7 +254,7 @@ describe Chef::Knife::Ssh do end it "uses the ssh_gateway_identity file" do - expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { :keys => "~/.ssh/aws-gateway.rsa", :keys_only => true }) + expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { :keys => "#{ENV['HOME']}/.ssh/aws-gateway.rsa", :keys_only => true }) @knife.run expect(@knife.config[:ssh_gateway_identity]).to eq("~/.ssh/aws-gateway.rsa") end @@ -268,7 +268,7 @@ describe Chef::Knife::Ssh do end it "uses the ssh_gateway_identity file" do - expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { :keys => "~/.ssh/aws-gateway.rsa", :keys_only => true }) + expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { :keys => "#{ENV['HOME']}/.ssh/aws-gateway.rsa", :keys_only => true }) @knife.run expect(@knife.config[:ssh_gateway_identity]).to eq("~/.ssh/aws-gateway.rsa") end |