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]
|
||||
- hosts/arch: NFS works with latest versions. [GH-4224]
|
||||
- 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]
|
||||
- provisioners/chef: Chef client cleanup should work. [GH-4099]
|
||||
- provisioners/puppet: Manifest file can be a directory. [GH-4169]
|
||||
|
|
|
@ -114,20 +114,32 @@ module VagrantPlugins
|
|||
|
||||
def forwarded_ports(include_ssh=false)
|
||||
mappings = {}
|
||||
random = []
|
||||
|
||||
@machine.config.vm.networks.each do |type, options|
|
||||
next if type != :forwarded_port
|
||||
|
||||
# Don't include SSH if we've explicitly asked not to
|
||||
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
|
||||
end
|
||||
|
||||
mappings.values.map do |fp|
|
||||
# Build the results
|
||||
result = random.map(&:to_s)
|
||||
result += mappings.values.map do |fp|
|
||||
protocol = ""
|
||||
protocol = "/udp" if fp[:protocol].to_s == "udp"
|
||||
"#{fp[:host]}:#{fp[:guest]}#{protocol}"
|
||||
end.compact
|
||||
|
||||
result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue