Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[CHEF-1535] Let knife ssh more descriptive in case of absent gems

  • Loading branch information...
commit 6471762ba8bd20c446fa254ba4b7d85f3b099875 1 parent 9ea4765
@akzhan akzhan authored danielsdeleo committed
Showing with 15 additions and 3 deletions.
  1. +12 −0 chef/lib/chef/knife.rb
  2. +3 −3 chef/lib/chef/knife/ssh.rb
View
12 chef/lib/chef/knife.rb
@@ -151,6 +151,18 @@ def self.subcommand_class_from(args)
subcommand_class || subcommand_not_found!(args)
end
+ protected
+
+ def load_late_dependency(dep, gem_name = nil)
+ begin
+ require dep
+ rescue LoadError
+ gem_name ||= dep.gsub('/', '-')
+ Chef::Log.fatal "#{gem_name} is not installed. run \"gem install #{gem_name}\" to install it."
+ exit 1
+ end
+ end
+
private
# :nodoc:
View
6 chef/lib/chef/knife/ssh.rb
@@ -268,10 +268,10 @@ def run
end
def load_late_dependencies
- require 'net/ssh/multi'
require 'readline'
- require 'highline'
-
+ %w[net/ssh/multi highline].each do |dep|
+ load_late_dependency dep
+ end
assert_net_ssh_version_acceptable!
end
Please sign in to comment.
Something went wrong with that request. Please try again.