Remote commands show output when fails [GH-1203]
This commit is contained in:
parent
a0543d7c7c
commit
62c1bea7d3
|
@ -1,5 +1,10 @@
|
||||||
## 1.2.5 (unreleased)
|
## 1.2.5 (unreleased)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- Remote commands that fail will now show the stdout/stderr of the
|
||||||
|
command that failed. [GH-1203]
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
- Fix uninitialized constant error when configuring Arch Linux network. [GH-1734]
|
- Fix uninitialized constant error when configuring Arch Linux network. [GH-1734]
|
||||||
|
|
|
@ -57,8 +57,18 @@ module VagrantPlugins
|
||||||
}.merge(opts || {})
|
}.merge(opts || {})
|
||||||
|
|
||||||
# Connect via SSH and execute the command in the shell.
|
# Connect via SSH and execute the command in the shell.
|
||||||
|
stdout = ""
|
||||||
|
stderr = ""
|
||||||
exit_status = connect do |connection|
|
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
|
end
|
||||||
|
|
||||||
# Check for any errors
|
# Check for any errors
|
||||||
|
@ -66,7 +76,11 @@ module VagrantPlugins
|
||||||
# The error classes expect the translation key to be _key,
|
# The error classes expect the translation key to be _key,
|
||||||
# but that makes for an ugly configuration parameter, so we
|
# but that makes for an ugly configuration parameter, so we
|
||||||
# set it here from `error_key`
|
# 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
|
raise opts[:error_class], error_opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -397,6 +397,14 @@ en:
|
||||||
Vagrant assumes that this means the command failed!
|
Vagrant assumes that this means the command failed!
|
||||||
|
|
||||||
%{command}
|
%{command}
|
||||||
|
|
||||||
|
Stdout from the command:
|
||||||
|
|
||||||
|
%{stdout}
|
||||||
|
|
||||||
|
Stderr from the command:
|
||||||
|
|
||||||
|
%{stderr}
|
||||||
ssh_connect_eacces: |-
|
ssh_connect_eacces: |-
|
||||||
SSH is getting permission denied errors when attempting to connect
|
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
|
to the IP for SSH. This is usually caused by network rules and not being
|
||||||
|
|
Loading…
Reference in New Issue