Class: Vagrant::LXC::Action::ClearForwardedPorts
- Inherits:
-
Object
- Object
- Vagrant::LXC::Action::ClearForwardedPorts
- Defined in:
- lib/vagrant-lxc/action/clear_forwarded_ports.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ClearForwardedPorts
constructor
A new instance of ClearForwardedPorts.
Constructor Details
#initialize(app, env) ⇒ ClearForwardedPorts
Returns a new instance of ClearForwardedPorts.
5 6 7 8 |
# File 'lib/vagrant-lxc/action/clear_forwarded_ports.rb', line 5 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant::lxc::action::clear_forwarded_ports") end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-lxc/action/clear_forwarded_ports.rb', line 10 def call(env) @env = env if redir_pids.any? env[:ui].info I18n.t("vagrant.actions.vm.clear_forward_ports.deleting") redir_pids.each do |pid| next unless is_redir_pid?(pid) @logger.debug "Killing pid #{pid}" system "pkill -TERM -P #{pid}" end @logger.info "Removing redir pids files" remove_redir_pids else @logger.info "No redir pids found" end @app.call env end |