providers/docker: don't port map SSH if no has_ssh [GH-3857]

This commit is contained in:
Mitchell Hashimoto 2014-05-20 19:47:21 -07:00
parent a7a33ec7c4
commit 5bd0a99b31
2 changed files with 10 additions and 5 deletions

View File

@ -28,6 +28,8 @@ BUG FIXES:
`docker stop`. [GH-3798]
- providers/docker: Better error messaging when SSH is not ready
direct to container. [GH-3763]
- providers/docker: Don't port map SSH port if container doesn't
support SSH. [GH-3857]
- providers/virtualbox: On Windows, check `VBOX_MSI_INSTALL_PATH`
for VBoxManage path as well. [GH-3852]
- provisioners/puppet: Fix setting facter vars with Windows

View File

@ -105,19 +105,22 @@ module VagrantPlugins
image: image,
links: links,
name: container_name,
ports: forwarded_ports,
ports: forwarded_ports(@provider_config.has_ssh),
privileged: @provider_config.privileged,
pty: false,
volumes: @provider_config.volumes,
}
end
def forwarded_ports
def forwarded_ports(include_ssh=false)
mappings = {}
@machine.config.vm.networks.each do |type, options|
if type == :forwarded_port
mappings[options[:host]] = options
end
next if type != :forwarded_port
# Don't include SSH if we've explicitly asked not to
next if options[:id] == "ssh" && !include_ssh
mappings[options[:host]] = options
end
mappings.values.map do |fp|