summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2019-05-28 21:40:10 +0530
committerBryan McLellan <btm@loftninjas.org>2019-05-28 09:10:10 -0700
commit8ce98d299e2522206a11a9f7a88c796c9614be00 (patch)
treee7e51dbeddf45565ce9451d8c3f634462a9ce11f
parentcc6c31616126c38d93dafd1f0475ac3ae5815a65 (diff)
downloadchef-8ce98d299e2522206a11a9f7a88c796c9614be00.tar.gz
Fix ssh user set from cli (#8558)
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/knife/bootstrap.rb4
-rw-r--r--spec/unit/knife/bootstrap_spec.rb8
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 1da36db37f..926af64b4b 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -1001,8 +1001,8 @@ class Chef
config[key]
else
lookup_key = knife_config_key || key
- if Chef::Config[:knife].key?(lookup_key)
- Chef::Config[:knife][lookup_key]
+ if Chef::Config[:knife].key?(lookup_key) || config.key?(lookup_key)
+ Chef::Config[:knife][lookup_key] || config[lookup_key]
else
default
end
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index 13e7906de8..f92af74284 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -1002,7 +1002,7 @@ describe Chef::Knife::Bootstrap do
let(:expected_result) do
{
logger: Chef::Log, # not configurable
- max_wait_until_ready: 9999,
+ max_wait_until_ready: 9999.0,
connection_timeout: 9999,
user: "sshbob",
bastion_host: "mygateway.local",
@@ -1012,7 +1012,7 @@ describe Chef::Knife::Bootstrap do
keys_only: true,
key_files: ["/identity.pem", "/gateway.pem"],
sudo: false,
- verify_host_key: false,
+ verify_host_key: nil,
port: 9999,
non_interactive: true,
pty: true,
@@ -1056,7 +1056,7 @@ describe Chef::Knife::Bootstrap do
let(:expected_result) do
{
logger: Chef::Log, # not configurable
- max_wait_until_ready: 150, # cli
+ max_wait_until_ready: 150.0, # cli
connection_timeout: 120, # cli
user: "sshalice", # cli
password: "feta cheese", # cli
@@ -1067,7 +1067,7 @@ describe Chef::Knife::Bootstrap do
keys_only: false, # implied false from config password present
key_files: ["/identity.pem", "/gateway.pem"], # Config
sudo: true, # ccli
- verify_host_key: false, # Config
+ verify_host_key: nil, # Config
port: 12, # cli
non_interactive: true,
pty: true,