[DRE-commits] [vagrant-libvirt] 69/163: fix redirection of STDOUT/ERR of ssh port forwarding process (#226)
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Apr 24 13:57:07 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to annotated tag 0.0.26
in repository vagrant-libvirt.
commit 1f9c7a70cea657b6f3684c1a0d86cd6e66521345
Author: Adam Spiers <vagrant-libvirt at adamspiers.org>
Date: Mon Oct 27 10:44:18 2014 +0000
fix redirection of STDOUT/ERR of ssh port forwarding process (#226)
The existing invocation fails to spawn correctly, and even if that
were the case, redirecting STDOUT/STDERR to /dev/null risks losing
valuable debug, as seen in #225.
Closes #226.
https://github.com/pradels/vagrant-libvirt/issues/226
---
lib/vagrant-libvirt/action/forward_ports.rb | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/vagrant-libvirt/action/forward_ports.rb b/lib/vagrant-libvirt/action/forward_ports.rb
index 29de638..5fa86f0 100644
--- a/lib/vagrant-libvirt/action/forward_ports.rb
+++ b/lib/vagrant-libvirt/action/forward_ports.rb
@@ -118,7 +118,20 @@ module VagrantPlugins
ssh_cmd << "ssh #{options} #{params}"
@logger.debug "Forwarding port with `#{ssh_cmd}`"
- spawn(ssh_cmd, [:out, :err] => '/dev/null')
+ log_file = ssh_forward_log_file(host_ip, host_port,
+ guest_ip, guest_port)
+ @logger.info "Logging to #{log_file}"
+ spawn(ssh_cmd, [:out, :err] => [log_file, 'w'])
+ end
+
+ def ssh_forward_log_file(host_ip, host_port, guest_ip, guest_port)
+ log_dir = @env[:machine].data_dir.join('logs')
+ log_dir.mkdir unless log_dir.directory?
+ File.join(
+ log_dir,
+ 'ssh-forwarding-%s_%s-%s_%s.log' %
+ [ host_ip, host_port, guest_ip, guest_port ]
+ )
end
def store_ssh_pid(host_port, ssh_pid)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git
More information about the Pkg-ruby-extras-commits
mailing list