providers/docker: host IP and protocol is respected [GH-4505]
This commit is contained in:
parent
5228437b30
commit
fb1a825c0d
|
@ -5,6 +5,8 @@ BUG FIXES:
|
|||
- core: Fix cases where sometimes SSH connection would hang.
|
||||
- providers/docker: Create args works. [GH-4526]
|
||||
- providers/docker: Nicer error if package is called. [GH-4595]
|
||||
- providers/docker: Host IP restriction is forwarded through. [GH-4505]
|
||||
- providers/docker: Protocol is now honored in direct `ports settings.
|
||||
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
|
||||
clean up an existing VM. [GH-4681]
|
||||
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
||||
|
|
|
@ -143,7 +143,9 @@ module VagrantPlugins
|
|||
result += mappings.values.map do |fp|
|
||||
protocol = ""
|
||||
protocol = "/udp" if fp[:protocol].to_s == "udp"
|
||||
"#{fp[:host]}:#{fp[:guest]}#{protocol}"
|
||||
host_ip = ""
|
||||
host_ip = "#{fp[:host_ip]}:" if fp[:host_ip]
|
||||
"#{host_ip}#{fp[:host]}:#{fp[:guest]}#{protocol}"
|
||||
end.compact
|
||||
|
||||
result
|
||||
|
|
|
@ -8,9 +8,19 @@ module VagrantPlugins
|
|||
|
||||
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: host.to_i, guest: guest.to_i,
|
||||
host_ip: host_ip,
|
||||
protocol: protocol
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
|
|
@ -96,7 +96,7 @@ module VagrantPlugins
|
|||
@image = UNSET_VALUE
|
||||
@name = UNSET_VALUE
|
||||
@links = []
|
||||
@ports = []
|
||||
@ports = UNSET_VALUE
|
||||
@privileged = UNSET_VALUE
|
||||
@remains_running = UNSET_VALUE
|
||||
@volumes = []
|
||||
|
@ -148,6 +148,7 @@ module VagrantPlugins
|
|||
@has_ssh = false if @has_ssh == UNSET_VALUE
|
||||
@image = nil if @image == UNSET_VALUE
|
||||
@name = nil if @name == UNSET_VALUE
|
||||
@ports = [] if @ports == UNSET_VALUE
|
||||
@privileged = false if @privileged == UNSET_VALUE
|
||||
@remains_running = true if @remains_running == UNSET_VALUE
|
||||
@vagrant_machine = nil if @vagrant_machine == UNSET_VALUE
|
||||
|
|
Loading…
Reference in New Issue