summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc A. Paradise <marcparadise@users.noreply.github.com>2021-07-27 12:09:19 -0400
committerGitHub <noreply@github.com>2021-07-27 12:09:19 -0400
commit68293041488b07d2b614c54333acf3670ea2a66a (patch)
tree28ef45f7bfcff294ab554a86a1a10ed37892c1b7
parentc75e8810ae3b82745ec2000b8cba42deb02e2e46 (diff)
parent3616f922963dd8c17651080a0a1d93c4514acaa4 (diff)
downloadchef-68293041488b07d2b614c54333acf3670ea2a66a.tar.gz
Merge pull request #11531 from MsysTechnologiesllc/SangmeshA/Fix_Knife_Boostrap_using_ssh_config_file
Fixed issues facing while bootstrapping the node using ssh config file.
-rw-r--r--knife/lib/chef/knife/bootstrap/train_connector.rb6
-rw-r--r--knife/spec/unit/knife/bootstrap_spec.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/knife/lib/chef/knife/bootstrap/train_connector.rb b/knife/lib/chef/knife/bootstrap/train_connector.rb
index f155e32225..1faae2eeff 100644
--- a/knife/lib/chef/knife/bootstrap/train_connector.rb
+++ b/knife/lib/chef/knife/bootstrap/train_connector.rb
@@ -240,7 +240,7 @@ class Chef
# Now that everything is populated, fill in anything missing
# that may be found in user ssh config
- opts.merge!(missing_opts_from_ssh_config(opts, opts_in))
+ opts.merge!(missing_opts_from_ssh_config(opts))
Train.target_config(opts)
end
@@ -297,12 +297,12 @@ class Chef
# in the configuration passed in.
# This is necessary because train will default these values
# itself - causing SSH config data to be ignored
- def missing_opts_from_ssh_config(config, opts_in)
+ def missing_opts_from_ssh_config(config)
return {} unless config[:backend] == "ssh"
host_cfg = ssh_config_for_host(config[:host])
opts_out = {}
- opts_in.each do |key, _value|
+ host_cfg.each do |key, _value|
if SSH_CONFIG_OVERRIDE_KEYS.include?(key) && !config.key?(key)
opts_out[key] = host_cfg[key]
end
diff --git a/knife/spec/unit/knife/bootstrap_spec.rb b/knife/spec/unit/knife/bootstrap_spec.rb
index 30878edf39..bf5b17cc42 100644
--- a/knife/spec/unit/knife/bootstrap_spec.rb
+++ b/knife/spec/unit/knife/bootstrap_spec.rb
@@ -1307,7 +1307,7 @@ describe Chef::Knife::Bootstrap do
context "when no identity file is specified" do
it "generates the expected configuration (no keys, keys_only false)" do
expect(knife.ssh_identity_opts).to eq( {
- key_files: [ ],
+ key_files: [],
keys_only: false,
})
end