Module: VagrantPlugins::ProviderVeertu::Cap

Defined in:
lib/vagrant-veertu/cap.rb,
lib/vagrant-veertu/cap/public_address.rb

Defined Under Namespace

Modules: PublicAddress

Class Method Summary collapse

Class Method Details

.forwarded_ports(machine) ⇒ Hash<Integer, Integer>

Reads the forwarded ports that currently exist on the machine itself. This raises an exception if the machine isn’t running.

This also may not match up with configured forwarded ports, because Vagrant auto port collision fixing may have taken place.

Returns:

  • (Hash<Integer, Integer>)

    Host => Guest port mappings.



11
12
13
14
15
16
17
18
19
# File 'lib/vagrant-veertu/cap.rb', line 11

def self.forwarded_ports(machine)
  return nil if machine.state.id != :running

  {}.tap do |result|
    machine.provider.driver.read_forwarded_ports.each do |_, _, h, g|
      result[h] = g
    end
  end
end