Remote commands show output when fails [GH-1203]

This commit is contained in:
Mitchell Hashimoto 2013-07-17 23:39:42 -04:00
parent a0543d7c7c
commit 62c1bea7d3
3 changed files with 29 additions and 2 deletions

View File

@ -1,5 +1,10 @@
## 1.2.5 (unreleased)
IMPROVEMENTS:
- Remote commands that fail will now show the stdout/stderr of the
command that failed. [GH-1203]
BUG FIXES:
- Fix uninitialized constant error when configuring Arch Linux network. [GH-1734]

View File

@ -57,8 +57,18 @@ module VagrantPlugins
}.merge(opts || {})
# Connect via SSH and execute the command in the shell.
stdout = ""
stderr = ""
exit_status = connect do |connection|
shell_execute(connection, command, opts[:sudo], &block)
shell_execute(connection, command, opts[:sudo]) do |type, data|
if type == :stdout
stdout += data
elsif type == :stderr
stderr += data
end
block.call(type, data) if block
end
end
# Check for any errors
@ -66,7 +76,11 @@ module VagrantPlugins
# The error classes expect the translation key to be _key,
# but that makes for an ugly configuration parameter, so we
# set it here from `error_key`
error_opts = opts.merge(:_key => opts[:error_key])
error_opts = opts.merge(
:_key => opts[:error_key],
:stdout => stdout,
:stderr => stderr
)
raise opts[:error_class], error_opts
end

View File

@ -397,6 +397,14 @@ en:
Vagrant assumes that this means the command failed!
%{command}
Stdout from the command:
%{stdout}
Stderr from the command:
%{stderr}
ssh_connect_eacces: |-
SSH is getting permission denied errors when attempting to connect
to the IP for SSH. This is usually caused by network rules and not being