Add more logging but default to it off for now until we add more later
This commit is contained in:
parent
ad36340674
commit
0515d9a61e
|
@ -303,7 +303,7 @@ module Vagrant
|
||||||
elsif ENV["VAGRANT_LOG"]
|
elsif ENV["VAGRANT_LOG"]
|
||||||
output = ENV["VAGRANT_LOG"]
|
output = ENV["VAGRANT_LOG"]
|
||||||
else
|
else
|
||||||
output = log_path.join("#{Time.now.to_i}.log")
|
output = nil #log_path.join("#{Time.now.to_i}.log")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create the logger and custom formatter
|
# Create the logger and custom formatter
|
||||||
|
|
|
@ -57,6 +57,7 @@ module Vagrant
|
||||||
# (GH-51). As a workaround, we fork and wait. On all other platforms,
|
# (GH-51). As a workaround, we fork and wait. On all other platforms,
|
||||||
# we simply exec.
|
# we simply exec.
|
||||||
command = "ssh #{command_options.join(" ")} #{options[:username]}@#{options[:host]}".strip
|
command = "ssh #{command_options.join(" ")} #{options[:username]}@#{options[:host]}".strip
|
||||||
|
env.logger.info("ssh") { "Invoking SSH: #{command}" }
|
||||||
safe_exec(command)
|
safe_exec(command)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,6 +77,8 @@ module Vagrant
|
||||||
session, options = @current_session
|
session, options = @current_session
|
||||||
|
|
||||||
if !session || options != opts
|
if !session || options != opts
|
||||||
|
env.logger.info("ssh") { "Connecting to SSH: #{env.config.ssh.host} #{opts[:port]}" }
|
||||||
|
|
||||||
# The exceptions which are acceptable to retry on during
|
# The exceptions which are acceptable to retry on during
|
||||||
# attempts to connect to SSH
|
# attempts to connect to SSH
|
||||||
exceptions = [Errno::ECONNREFUSED, Net::SSH::Disconnect]
|
exceptions = [Errno::ECONNREFUSED, Net::SSH::Disconnect]
|
||||||
|
@ -94,6 +97,8 @@ module Vagrant
|
||||||
|
|
||||||
# Save the new session along with the options which created it
|
# Save the new session along with the options which created it
|
||||||
@current_session = [session, opts]
|
@current_session = [session, opts]
|
||||||
|
else
|
||||||
|
env.logger.info("ssh") { "Using cached SSH session: #{session}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Yield our session for executing
|
# Yield our session for executing
|
||||||
|
@ -143,11 +148,14 @@ module Vagrant
|
||||||
# Windows systems don't have this issue
|
# Windows systems don't have this issue
|
||||||
return if Util::Platform.windows?
|
return if Util::Platform.windows?
|
||||||
|
|
||||||
|
env.logger.info("ssh") { "Checking key permissions: #{key_path}" }
|
||||||
|
|
||||||
stat = File.stat(key_path)
|
stat = File.stat(key_path)
|
||||||
|
|
||||||
if stat.owned? && file_perms(key_path) != "600"
|
if stat.owned? && file_perms(key_path) != "600"
|
||||||
File.chmod(0600, key_path)
|
env.logger.info("ssh") { "Attempting to correct key permissions to 0600" }
|
||||||
|
|
||||||
|
File.chmod(0600, key_path)
|
||||||
raise Errors::SSHKeyBadPermissions, :key_path => key_path if file_perms(key_path) != "600"
|
raise Errors::SSHKeyBadPermissions, :key_path => key_path if file_perms(key_path) != "600"
|
||||||
end
|
end
|
||||||
rescue Errno::EPERM
|
rescue Errno::EPERM
|
||||||
|
@ -168,8 +176,7 @@ module Vagrant
|
||||||
# `config.ssh.forwarded_port_key`.
|
# `config.ssh.forwarded_port_key`.
|
||||||
def port(opts={})
|
def port(opts={})
|
||||||
# Check if port was specified in options hash
|
# Check if port was specified in options hash
|
||||||
pnum = opts[:port]
|
return opts[:port] if opts[:port]
|
||||||
return pnum if pnum
|
|
||||||
|
|
||||||
# Check if a port was specified in the config
|
# Check if a port was specified in the config
|
||||||
return env.config.ssh.port if env.config.ssh.port
|
return env.config.ssh.port if env.config.ssh.port
|
||||||
|
|
|
@ -51,6 +51,7 @@ module Vagrant
|
||||||
# **This method should never be called manually.**
|
# **This method should never be called manually.**
|
||||||
def load_system!(system=nil)
|
def load_system!(system=nil)
|
||||||
system ||= env.config.vm.system
|
system ||= env.config.vm.system
|
||||||
|
env.logger.info("vm: #{name}") { "Loading system: #{system}" }
|
||||||
|
|
||||||
if system.is_a?(Class)
|
if system.is_a?(Class)
|
||||||
raise Errors::VMSystemError, :_key => :invalid_class, :system => system.to_s if !(system <= Systems::Base)
|
raise Errors::VMSystemError, :_key => :invalid_class, :system => system.to_s if !(system <= Systems::Base)
|
||||||
|
|
Loading…
Reference in New Issue