Class: HashiCorp::VagrantVMwareDesktop::Action::PruneForwardedPorts

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/prune_forwarded_ports.rb

Overview

This action prunes out forwarded ports that aren’t in use any longer, usually by machines that don’t exist anymore.

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ PruneForwardedPorts

Returns a new instance of PruneForwardedPorts.



13
14
15
16
# File 'lib/vagrant-vmware-desktop/action/prune_forwarded_ports.rb', line 13

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::prune_forwarded_ports")
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-vmware-desktop/action/prune_forwarded_ports.rb', line 18

def call(env)
  @logger.info("Pruning forwarded ports...")
  Helper::Lock.lock(env[:machine], "vmware-network") do
    env[:machine].provider.driver.prune_forwarded_ports
  end

  # Carry on
  @app.call(env)
end