More verbose logging for SSH
This commit is contained in:
parent
87b03609db
commit
e68eb1f4f3
|
@ -71,6 +71,8 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload(from, to)
|
def upload(from, to)
|
||||||
|
@logger.debug("Uploading: #{from} to #{to}")
|
||||||
|
|
||||||
# Do an SCP-based upload...
|
# Do an SCP-based upload...
|
||||||
connect do |connection|
|
connect do |connection|
|
||||||
scp = Net::SCP.new(connection)
|
scp = Net::SCP.new(connection)
|
||||||
|
@ -102,7 +104,7 @@ module Vagrant
|
||||||
# If the @connection is still around, then it is valid,
|
# If the @connection is still around, then it is valid,
|
||||||
# and we use it.
|
# and we use it.
|
||||||
if @connection
|
if @connection
|
||||||
@logger.info("Re-using SSH connection.")
|
@logger.debug("Re-using SSH connection.")
|
||||||
return yield @connection if block_given?
|
return yield @connection if block_given?
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -148,13 +150,11 @@ module Vagrant
|
||||||
rescue Errno::ECONNREFUSED
|
rescue Errno::ECONNREFUSED
|
||||||
# This is raised if we failed to connect the max amount of times
|
# This is raised if we failed to connect the max amount of times
|
||||||
raise Errors::SSHConnectionRefused
|
raise Errors::SSHConnectionRefused
|
||||||
ensure
|
|
||||||
# Be sure the connection is always closed
|
|
||||||
# connection.close if connection && !connection.closed?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Executes the command on an SSH connection within a login shell.
|
# Executes the command on an SSH connection within a login shell.
|
||||||
def shell_execute(connection, command, sudo=false)
|
def shell_execute(connection, command, sudo=false)
|
||||||
|
@logger.info("Execute: #{command} (sudo=#{sudo.inspect})")
|
||||||
exit_status = nil
|
exit_status = nil
|
||||||
|
|
||||||
# Determine the shell to execute. If we are using `sudo` then we
|
# Determine the shell to execute. If we are using `sudo` then we
|
||||||
|
@ -170,6 +170,7 @@ module Vagrant
|
||||||
if block_given?
|
if block_given?
|
||||||
# Filter out the clear screen command
|
# Filter out the clear screen command
|
||||||
data.gsub!("\e[H", "")
|
data.gsub!("\e[H", "")
|
||||||
|
@logger.debug("stdout: #{data}")
|
||||||
yield :stdout, data
|
yield :stdout, data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -178,12 +179,14 @@ module Vagrant
|
||||||
if block_given?
|
if block_given?
|
||||||
# Filter out the clear screen command
|
# Filter out the clear screen command
|
||||||
data.gsub!("\e[H", "")
|
data.gsub!("\e[H", "")
|
||||||
|
@logger.debug("stderr: #{data}")
|
||||||
yield :stderr, data
|
yield :stderr, data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ch2.on_request("exit-status") do |ch3, data|
|
ch2.on_request("exit-status") do |ch3, data|
|
||||||
exit_status = data.read_long
|
exit_status = data.read_long
|
||||||
|
@logger.debug("Exit status: #{exit_status}")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the terminal
|
# Set the terminal
|
||||||
|
|
Loading…
Reference in New Issue