summaryrefslogtreecommitdiff
path: root/lib/chef/knife/bootstrap
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-05-20 18:05:36 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-05-20 18:05:36 -0700
commit9dbdb769bfd963f82eb4bfea53c83501d0193766 (patch)
treedaba4babc4ba8eb73bd765783dc8a53a7abff6be /lib/chef/knife/bootstrap
parent248344cfe776b66a8da563c985e34d9c99967791 (diff)
downloadchef-9dbdb769bfd963f82eb4bfea53c83501d0193766.tar.gz
This hits the ones that are most frequently required.lcg/require-idempotency
Stops the kernel from scanning through all the activated gems every time in order to resolve names into pathnames. See rubygems/rubygems#2762 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/knife/bootstrap')
-rw-r--r--lib/chef/knife/bootstrap/client_builder.rb2
-rw-r--r--lib/chef/knife/bootstrap/train_connector.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/knife/bootstrap/client_builder.rb b/lib/chef/knife/bootstrap/client_builder.rb
index 1864297053..87dd03d6ed 100644
--- a/lib/chef/knife/bootstrap/client_builder.rb
+++ b/lib/chef/knife/bootstrap/client_builder.rb
@@ -20,7 +20,7 @@ require_relative "../../node"
require_relative "../../server_api"
require_relative "../../api_client/registration"
require_relative "../../api_client"
-require "tmpdir"
+require "tmpdir" unless defined?(Dir.mktmpdir)
class Chef
class Knife
diff --git a/lib/chef/knife/bootstrap/train_connector.rb b/lib/chef/knife/bootstrap/train_connector.rb
index f1b4816049..af09a8c366 100644
--- a/lib/chef/knife/bootstrap/train_connector.rb
+++ b/lib/chef/knife/bootstrap/train_connector.rb
@@ -16,8 +16,8 @@
#
require "train"
-require "tempfile"
-require "uri"
+require "tempfile" unless defined?(Tempfile)
+require "uri" unless defined?(URI)
class Chef
class Knife
@@ -305,7 +305,7 @@ class Chef
# Having this as a method makes it easier to mock
# SSH Config for testing.
def ssh_config_for_host(host)
- require "net/ssh"
+ require "net/ssh" unless defined?(Net::SSH)
Net::SSH::Config.for(host)
end
end