Sha256: 1c45d48bd6b39215ae14206705e7f4f3190e6445cda2b4b9cab9fafe26d6048b

Contents?: true

Size: 1.09 KB

Versions: 47

Compression:

Stored size: 1.09 KB

Contents

require "vagrant/util/scoped_hash_override"

module VagrantPlugins
  module ProviderVirtualBox
    module Util
      module CompileForwardedPorts
        include Vagrant::Util::ScopedHashOverride

        # This method compiles the forwarded ports into {ForwardedPort}
        # models.
        def compile_forwarded_ports(config)
          mappings = {}

          config.vm.networks.each do |type, options|
            if type == :forwarded_port
              guest_port = options[:guest]
              host_port  = options[:host]
              host_ip    = options[:host_ip]
              protocol   = options[:protocol] || "tcp"
              options    = scoped_hash_override(options, :virtualbox)
              id         = options[:id]

              # If the forwarded port was marked as disabled, ignore.
              next if options[:disabled]

              key = "#{host_ip}#{protocol}#{host_port}"
              mappings[key] =
                Model::ForwardedPort.new(id, host_port, guest_port, options)
            end
          end

          mappings.values
        end
      end
    end
  end
end

Version data entries

47 entries across 43 versions & 5 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.3.3.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.3.2.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.19.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.18.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.16.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.14.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.10.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.9.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.8.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.7.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.6.2 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.6.1 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.6.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.5.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.4.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.3.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-2.2.2.0 plugins/providers/virtualbox/util/compile_forwarded_ports.rb