Sha256: c3165f754b7c7f1a9e1fc7aa47f99a8f94dbd88dde38ed1dfb5dd3dde38e1c93

Contents?: true

Size: 1.02 KB

Versions: 22

Compression:

Stored size: 1.02 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]
              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]

              mappings[host_port.to_s + protocol.to_s] =
                Model::ForwardedPort.new(id, host_port, guest_port, options)
            end
          end

          mappings.values
        end
      end
    end
  end
end

Version data entries

22 entries across 19 versions & 6 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.9.1.1 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.8.5.2 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.8.5.1 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.8.4.2 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.8.4.1 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.8.1.2 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-unbundled-1.8.1.1 plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/providers/virtualbox/util/compile_forwarded_ports.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/providers/virtualbox/util/compile_forwarded_ports.rb