summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorsiddheshwar-more <siddheshwar.more@clogeny.com>2014-10-09 21:45:16 +0530
committersiddheshwar-more <siddheshwar.more@clogeny.com>2014-10-09 21:45:16 +0530
commit19cd53bcf0dad14c8def6aaf719f548b86d46164 (patch)
treee3c93cdaa720182f5f5950011662fd3931529505 /spec/unit
parentd75c5b69de9ec183a0ba1c90c6dc5e3c58799301 (diff)
downloadchef-19cd53bcf0dad14c8def6aaf719f548b86d46164.tar.gz
Fixed issue related to precedence of knife config options
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/knife/bootstrap_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index 70cdd20f35..0036a2e40d 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -479,6 +479,36 @@ describe Chef::Knife::Bootstrap do
knife_ssh_with_password_auth.config[:identity_file].should be_nil
end
end
+
+ context "config precedence" do
+ let(:knife_ssh) do
+ knife.name_args = ["config.example.com"]
+
+ knife.config[:ssh_port] = "cli_ssh_port"
+ knife.config[:ssh_gateway] = "cli_ssh_gateway"
+ knife.config[:forward_agent] = true
+ knife.config[:identity_file] = "cli_identity_file"
+ knife.config[:host_key_verify] = true
+ Chef::Config[:knife][:ssh_user] = "curiosity"
+ knife.config[:ssh_user] = "cli_ssh_user"
+ Chef::Config[:knife][:ssh_port] = "2430"
+ Chef::Config[:knife][:forward_agent] = false
+ Chef::Config[:knife][:identity_file] = "~/.ssh/you.rsa"
+ Chef::Config[:knife][:ssh_gateway] = "towel.blinkenlights.nl"
+ Chef::Config[:knife][:host_key_verify] = false
+ knife.stub(:render_template).and_return("")
+ knife.knife_ssh
+ end
+
+ it "CLI params should take precedence over knife.rb" do
+ knife_ssh.config[:ssh_user].should == 'cli_ssh_user'
+ knife_ssh.config[:identity_file].should == 'cli_identity_file'
+ knife_ssh.config[:ssh_gateway].should == 'cli_ssh_gateway'
+ knife_ssh.config[:ssh_port].should == 'cli_ssh_port'
+ knife_ssh.config[:forward_agent].should be_true
+ knife_ssh.config[:host_key_verify].should be_true
+ end
+ end
end
it "verifies that a server to bootstrap was given as a command line arg" do