Sha256: db47cf42245d9c18ad0cc66ca1763da787d7e90b485120c6a5c0bd15326591b5

Contents?: true

Size: 794 Bytes

Versions: 52

Compression:

Stored size: 794 Bytes

Contents

module VagrantPlugins
  module DockerProvider
    module Action
      class ForwardedPorts
        def initialize(app, env)
          @app = app
        end

        def call(env)
          env[:machine].provider_config.ports.each do |p|
            host_ip = nil
            protocol = "tcp"
            host, guest = p.split(":", 2)
            if guest.include?(":")
              host_ip = host
              host, guest = guest.split(":", 2)
            end

            guest, protocol = guest.split("/", 2) if guest.include?("/")
            env[:machine].config.vm.network "forwarded_port",
              host: host.to_i, guest: guest.to_i,
              host_ip: host_ip,
              protocol: protocol
          end

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

52 entries across 45 versions & 6 rubygems

Version Path
vagrant-unbundled-2.2.9.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.8.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.7.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.6.2 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.6.1 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.6.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.5.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.4.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.3.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.2.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.2.0.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.1.4.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.1.2.0 plugins/providers/docker/action/forwarded_ports.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/action/forwarded_ports.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/action/forwarded_ports.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/action/forwarded_ports.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/action/forwarded_ports.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/action/forwarded_ports.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/providers/docker/action/forwarded_ports.rb
vagrant-unbundled-2.1.1.0 plugins/providers/docker/action/forwarded_ports.rb