diff options
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/ssh.rb | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index f9dca7896a..9decacce13 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -448,7 +448,7 @@ class Chef ssh.config[:ssh_identity_file] = config[:ssh_identity_file] || config[:identity_file] ssh.config[:manual] = true ssh.config[:host_key_verify] = config[:host_key_verify] - ssh.config[:on_error] = :raise + ssh.config[:on_error] = true ssh end diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index b6abd67719..a596bfaabb 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -125,7 +125,7 @@ class Chef :long => "--exit-on-error", :description => "Immediately exit if an error is encountered", :boolean => true, - :proc => Proc.new { :raise } + :default => false option :tmux_split, :long => "--tmux-split", @@ -134,15 +134,13 @@ class Chef :default => false def session - config[:on_error] ||= :skip ssh_error_handler = Proc.new do |server| - case config[:on_error] - when :skip - ui.warn "Failed to connect to #{server.host} -- #{$!.class.name}: #{$!.message}" - $!.backtrace.each { |l| Chef::Log.debug(l) } - when :raise + if config[:on_error] #Net::SSH::Multi magic to force exception to be re-raised. throw :go, :raise + else + ui.warn "Failed to connect to #{server.host} -- #{$!.class.name}: #{$!.message}" + $!.backtrace.each { |l| Chef::Log.debug(l) } end end |