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] `docker stop`. [GH-3798]
- providers/docker: Better error messaging when SSH is not ready - providers/docker: Better error messaging when SSH is not ready
direct to container. [GH-3763] 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` - providers/virtualbox: On Windows, check `VBOX_MSI_INSTALL_PATH`
for VBoxManage path as well. [GH-3852] for VBoxManage path as well. [GH-3852]
- provisioners/puppet: Fix setting facter vars with Windows - provisioners/puppet: Fix setting facter vars with Windows

View File

@ -105,20 +105,23 @@ module VagrantPlugins
image: image, image: image,
links: links, links: links,
name: container_name, name: container_name,
ports: forwarded_ports, ports: forwarded_ports(@provider_config.has_ssh),
privileged: @provider_config.privileged, privileged: @provider_config.privileged,
pty: false, pty: false,
volumes: @provider_config.volumes, volumes: @provider_config.volumes,
} }
end end
def forwarded_ports def forwarded_ports(include_ssh=false)
mappings = {} mappings = {}
@machine.config.vm.networks.each do |type, options| @machine.config.vm.networks.each do |type, options|
if type == :forwarded_port 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 mappings[options[:host]] = options
end end
end
mappings.values.map do |fp| mappings.values.map do |fp|
# TODO: Support for the protocol argument # TODO: Support for the protocol argument