diff --git a/lib/vagrant/ssh.rb b/lib/vagrant/ssh.rb index 87467812e..6f2d5ae9b 100644 --- a/lib/vagrant/ssh.rb +++ b/lib/vagrant/ssh.rb @@ -150,6 +150,10 @@ module Vagrant # implementation also reports `:exit_status` to the block if given. def exec!(command, &block) block ||= Proc.new do |ch, type, data| + if type == :exit_status && data != 0 + raise ActionException.new(:ssh_bad_exit_status, :command => command) + end + ch[:result] ||= "" ch[:result] << data if [:stdout, :stderr].include?(type) end diff --git a/templates/strings.yml b/templates/strings.yml index 06667f97a..ac931a9dd 100644 --- a/templates/strings.yml +++ b/templates/strings.yml @@ -134,6 +134,11 @@ permissions on the following file to 0600 and then try running this command again: <%= key_path %> +:ssh_bad_exit_status: |- + The following SSH command responded with a non-zero exit status. + Vagrant assumes that this means the command failed! + + <%= command %> :ssh_unavailable_windows: |- `vagrant ssh` isn't available on the Windows platform. The vagrant.ppk file is available at