communicators/winrm: don't look up forwarded port if non-local [GH-3861]

This commit is contained in:
Mitchell Hashimoto 2014-05-20 19:30:53 -07:00
parent 3c4e129fb8
commit 690c119ae2
3 changed files with 9 additions and 2 deletions

View File

@ -19,6 +19,8 @@ BUG FIXES:
crash. [GH-3827] crash. [GH-3827]
- guests/windows: Private networks with static IPs work when there - guests/windows: Private networks with static IPs work when there
is more than one. [GH-3818] is more than one. [GH-3818]
- guests/windows: Don't look up a forwarded port for WinRM if we're
not accessing the local host. [GH-3861]
- providers/docker: Never do graceful shutdown, always use - providers/docker: Never do graceful shutdown, always use
`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

View File

@ -107,7 +107,8 @@ module VagrantPlugins
# about this machine. # about this machine.
def create_shell def create_shell
host_address = Helper.winrm_address(@machine) host_address = Helper.winrm_address(@machine)
host_port = Helper.winrm_port(@machine) host_port = Helper.winrm_port(
@machine, host_address == "127.0.0.1")
WinRMShell.new( WinRMShell.new(
host_address, host_address,

View File

@ -22,9 +22,13 @@ module VagrantPlugins
# #
# @param [Vagrant::Machine] machine # @param [Vagrant::Machine] machine
# @return [Integer] # @return [Integer]
def self.winrm_port(machine) def self.winrm_port(machine, local=true)
host_port = machine.config.winrm.port host_port = machine.config.winrm.port
if machine.config.winrm.guest_port if machine.config.winrm.guest_port
# If we're not requesting a local port, return
# the guest port directly.
return machine.config.winrm.guest_port if !local
# Search by guest port if we can. We use a provider capability # Search by guest port if we can. We use a provider capability
# if we have it. Otherwise, we just scan the Vagrantfile defined # if we have it. Otherwise, we just scan the Vagrantfile defined
# ports. # ports.