providers/docker: public_address reports host machine addr [GH-4342]

This commit is contained in:
Mitchell Hashimoto 2014-10-22 10:37:32 -07:00
parent 7988f0fb7c
commit 59fe62ec11
2 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,8 @@ BUG FIXES:
capture the final image. [GH-4598]
- providers/docker: NFS synced folders now work. [GH-4344]
- providers/docker: Read the created container ID more robustly.
- providers/docker: `vagrant share` uses correct IP of proxy VM if it
exists. [GH-4342]
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
clean up an existing VM. [GH-4681]
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]

View File

@ -5,6 +5,14 @@ module VagrantPlugins
def self.public_address(machine)
return nil if machine.state.id != :running
# If we're using a host VM, then return the IP of that
# rather than of our own machine.
if machine.provider.host_vm?
host_machine = machine.provider.host_vm
return nil if !host_machine.provider.capability?(:public_address)
return host_machine.provider.capability(:public_address)
end
ssh_info = machine.ssh_info
return nil if !ssh_info
ssh_info[:host]