providers/docker: single port works [GH-3991]
This commit is contained in:
parent
8e633acbc7
commit
1428ab0404
|
@ -38,6 +38,7 @@ BUG FIXES:
|
||||||
- guests/windows: Reboot after hostname change. [GH-3987]
|
- guests/windows: Reboot after hostname change. [GH-3987]
|
||||||
- hosts/arch: NFS works with latest versions. [GH-4224]
|
- hosts/arch: NFS works with latest versions. [GH-4224]
|
||||||
- hosts/windows: RDP command works without crash. [GH-3962]
|
- hosts/windows: RDP command works without crash. [GH-3962]
|
||||||
|
- providers/docker: Port on its own will choose random host port. [GH-3991]
|
||||||
- providers/virtualbox: Increase network device limit to 36. [GH-4206]
|
- providers/virtualbox: Increase network device limit to 36. [GH-4206]
|
||||||
- provisioners/chef: Chef client cleanup should work. [GH-4099]
|
- provisioners/chef: Chef client cleanup should work. [GH-4099]
|
||||||
- provisioners/puppet: Manifest file can be a directory. [GH-4169]
|
- provisioners/puppet: Manifest file can be a directory. [GH-4169]
|
||||||
|
|
|
@ -114,20 +114,32 @@ module VagrantPlugins
|
||||||
|
|
||||||
def forwarded_ports(include_ssh=false)
|
def forwarded_ports(include_ssh=false)
|
||||||
mappings = {}
|
mappings = {}
|
||||||
|
random = []
|
||||||
|
|
||||||
@machine.config.vm.networks.each do |type, options|
|
@machine.config.vm.networks.each do |type, options|
|
||||||
next if type != :forwarded_port
|
next if type != :forwarded_port
|
||||||
|
|
||||||
# Don't include SSH if we've explicitly asked not to
|
# Don't include SSH if we've explicitly asked not to
|
||||||
next if options[:id] == "ssh" && !include_ssh
|
next if options[:id] == "ssh" && !include_ssh
|
||||||
|
|
||||||
|
# If the guest port is 0, put it in the random group
|
||||||
|
if options[:guest] == 0
|
||||||
|
random << options[:host]
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
mappings[options[:host]] = options
|
mappings[options[:host]] = options
|
||||||
end
|
end
|
||||||
|
|
||||||
mappings.values.map do |fp|
|
# Build the results
|
||||||
|
result = random.map(&:to_s)
|
||||||
|
result += mappings.values.map do |fp|
|
||||||
protocol = ""
|
protocol = ""
|
||||||
protocol = "/udp" if fp[:protocol].to_s == "udp"
|
protocol = "/udp" if fp[:protocol].to_s == "udp"
|
||||||
"#{fp[:host]}:#{fp[:guest]}#{protocol}"
|
"#{fp[:host]}:#{fp[:guest]}#{protocol}"
|
||||||
end.compact
|
end.compact
|
||||||
|
|
||||||
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue