Sha256: 056bd89dbbf7c3ca56ede60440e3bd73dfc22d11da9a681d3effd3da949d5907

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

require 'vagrant/util/scoped_hash_override'

module VagrantPlugins
  module VCloudAir
    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]
              options    = scoped_hash_override(options, :vcloud)
              id         = options[:id]

              # skip forwarded rules already found in handle_nat_port_collisions
              next if options[:already_exists]

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

          mappings.values
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-vcloudair-0.5.3 lib/vagrant-vcloudair/util/compile_forwarded_ports.rb
vagrant-vcloudair-0.5.2 lib/vagrant-vcloudair/util/compile_forwarded_ports.rb
vagrant-vcloudair-0.5.1 lib/vagrant-vcloudair/util/compile_forwarded_ports.rb
vagrant-vcloudair-0.5.0 lib/vagrant-vcloudair/util/compile_forwarded_ports.rb