lib/vagrant/action/vm/forward_ports_helpers.rb
# Returns an array of used ports. This method is implemented
# differently depending on the VirtualBox version, but the
# behavior is the same.
#
# @return [Array<String>]
Returns an array of used ports. This method is implemented
differently depending on the VirtualBox version, but the
behavior is the same.
Returns an array of used ports . This method is implemented differently depending on the VirtualBox version but the behavior is the same .
def used_ports
          result = VirtualBox::VM.all.collect do |vm|
            if vm.running? && vm.uuid != @env["vm"].uuid
              vm.network_adapters.collect do |na|
                na.nat_driver.forwarded_ports.collect do |fp|
                  fp.hostport.to_i
                end
              end
            end
          end
          result.flatten.uniq
        end
def used_ports result = VirtualBox :: VM . all . collect do | vm | if vm . running? && vm . uuid != @env [ "vm" ] . uuid vm . network_adapters . collect do | na | na . nat_driver . forwarded_ports . collect do | fp | fp . hostport . to_i end end end end result . flatten . uniq end
Returns an array of used ports.
Returns an array of used ports .
None
Array<String>