Sha256: 9edb88d6a840464e11b6b6dd2514d34cec45b613b13ddcfae9fc6c8ebe2a807e

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 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]
              # TODO: Roll it back when forwarded ports will be completely
              # fixed in Parallels Desktop 10
              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

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-parallels-1.3.7 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.6 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.5 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.4 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.3 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.3.rc1 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.2 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.3.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb