Add support for logging redir output by setting REDIR_LOG env var

Closes #51
This commit is contained in:
Fabio Rehm 2013-07-28 02:28:03 -03:00
parent 14e8c41ee0
commit 7f58f7a26e
2 changed files with 5 additions and 2 deletions

View file

@ -11,6 +11,7 @@ FEATURES:
- Add support for salt-minion and add latest dev release for ubuntu codenamed saucy [#116](https://github.com/fgrehm/vagrant-lxc/pull/116) - Add support for salt-minion and add latest dev release for ubuntu codenamed saucy [#116](https://github.com/fgrehm/vagrant-lxc/pull/116)
- Add support for using a sudo wrapper script [#90](https://github.com/fgrehm/vagrant-lxc/issues/90) - Add support for using a sudo wrapper script [#90](https://github.com/fgrehm/vagrant-lxc/issues/90)
- `redir` will log to `/var/log/syslog` if `REDIR_LOG` env var is provided
IMPROVEMENTS: IMPROVEMENTS:

View file

@ -72,8 +72,10 @@ module Vagrant
end end
def redirect_port(host_ip, host_port, guest_ip, guest_port) def redirect_port(host_ip, host_port, guest_ip, guest_port)
host_ip = "--laddr=#{host_ip} " if host_ip params = %W( --lport=#{host_port} --caddr=#{guest_ip} --cport=#{guest_port} )
redir_cmd = "redir #{host_ip}--lport=#{host_port} --caddr=#{guest_ip} --cport=#{guest_port} 2>/dev/null" params.unshift "--laddr=#{host_ip}" if host_ip
params << '--syslog' if ENV['REDIR_LOG']
redir_cmd = "redir #{params.join(' ')} 2>/dev/null"
@logger.debug "Forwarding port with `#{redir_cmd}`" @logger.debug "Forwarding port with `#{redir_cmd}`"
spawn redir_cmd spawn redir_cmd