Sha256: 1da9938b9f1455f0fcf3f8fa601c826ea1a0e069762c1c1d683e8b0057b795b2

Contents?: true

Size: 1.18 KB

Versions: 22

Compression:

Stored size: 1.18 KB

Contents

require 'vagrant/util/scoped_hash_override'

module VagrantPlugins
  module Parallels
    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, :parallels)
              id         = options[:id]

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

              # Temporary disable automatically pre-configured forwarded ports
              # for SSH, since it is working not so well [GH-146]
              next if id == 'ssh'

              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 22 versions & 1 rubygems

Version Path
vagrant-parallels-2.2.2 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-2.2.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-2.2.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-2.1.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-2.0.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-2.0.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.8 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.7 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.6 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.5 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.4 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.3 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.2 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.7.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.6.3 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.6.2 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.6.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.6.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.5.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb