summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanga17 <sausekar@msystechnologies.com>2021-05-10 17:16:02 +0530
committersanga17 <sausekar@msystechnologies.com>2021-07-02 19:38:09 +0530
commit6c2642d198e578cf8196b03ab26546ca7eff5c42 (patch)
treec6a93fda6939b57865699da703c26fa87903a3cc
parent58ae290452c9dc898c4b41a3baeda51b5eb1660a (diff)
downloadchef-6c2642d198e578cf8196b03ab26546ca7eff5c42.tar.gz
Failing specs resolved
Signed-off-by: sanga17 <sausekar@msystechnologies.com>
-rw-r--r--knife/lib/chef/knife/bootstrap.rb6
-rw-r--r--knife/spec/unit/knife/bootstrap_spec.rb4
2 files changed, 7 insertions, 3 deletions
diff --git a/knife/lib/chef/knife/bootstrap.rb b/knife/lib/chef/knife/bootstrap.rb
index 7317fdc34b..756b73ec43 100644
--- a/knife/lib/chef/knife/bootstrap.rb
+++ b/knife/lib/chef/knife/bootstrap.rb
@@ -980,7 +980,11 @@ class Chef
gateway_identity_file = config[:ssh_gateway] ? config[:ssh_gateway_identity] : nil
unless gateway_identity_file.nil?
- opts[:key_files] << gateway_identity_file
+ if opts[:key_files].nil?
+ opts[:key_files] = [gateway_identity_file]
+ else
+ opts[:key_files] << gateway_identity_file
+ end
end
opts
diff --git a/knife/spec/unit/knife/bootstrap_spec.rb b/knife/spec/unit/knife/bootstrap_spec.rb
index 30878edf39..0ccbf8b01e 100644
--- a/knife/spec/unit/knife/bootstrap_spec.rb
+++ b/knife/spec/unit/knife/bootstrap_spec.rb
@@ -1127,7 +1127,7 @@ describe Chef::Knife::Bootstrap do
let(:expected_result) do
{
forward_agent: false,
- key_files: [],
+ key_files: nil,
logger: Chef::Log,
keys_only: false,
sudo: false,
@@ -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: nil,
keys_only: false,
})
end