From fd948f85522363acb6d3ee5c3f1a745bc5da6217 Mon Sep 17 00:00:00 2001 From: guerremdq Date: Thu, 20 Mar 2014 17:01:45 -0300 Subject: [PATCH] Add sudo for redir --- lib/vagrant-lxc/action/clear_forwarded_ports.rb | 2 +- lib/vagrant-lxc/action/forward_ports.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-lxc/action/clear_forwarded_ports.rb b/lib/vagrant-lxc/action/clear_forwarded_ports.rb index 48dbe5b..52d4450 100644 --- a/lib/vagrant-lxc/action/clear_forwarded_ports.rb +++ b/lib/vagrant-lxc/action/clear_forwarded_ports.rb @@ -15,7 +15,7 @@ module Vagrant redir_pids.each do |pid| next unless is_redir_pid?(pid) @logger.debug "Killing pid #{pid}" - system "pkill -TERM -P #{pid}" + system "sudo pkill -TERM -P #{pid}" end @logger.info "Removing redir pids files" diff --git a/lib/vagrant-lxc/action/forward_ports.rb b/lib/vagrant-lxc/action/forward_ports.rb index 5bc4efe..accc70c 100644 --- a/lib/vagrant-lxc/action/forward_ports.rb +++ b/lib/vagrant-lxc/action/forward_ports.rb @@ -79,7 +79,7 @@ module Vagrant params = %W( --lport=#{host_port} --caddr=#{guest_ip} --cport=#{guest_port} ) params.unshift "--laddr=#{host_ip}" if host_ip params << '--syslog' if ENV['REDIR_LOG'] - redir_cmd = "redir #{params.join(' ')} 2>/dev/null" + redir_cmd = "sudo redir #{params.join(' ')} 2>/dev/null" @logger.debug "Forwarding port with `#{redir_cmd}`" spawn redir_cmd