Use 127.0.0.1 instead of localhost for port use checking. [GH-1057]

Many systems actually don't have "localhost" setup as loopback in their
/etc/hosts file, so this would fail. This makes it pass.
This commit is contained in:
Mitchell Hashimoto 2012-08-08 20:02:18 -07:00
parent 002a83d7f7
commit 42744f71e8
2 changed files with 3 additions and 1 deletions

View File

@ -38,6 +38,8 @@
using SCP to upload files. [GH-924] using SCP to upload files. [GH-924]
- When console input is asked for (destroying a VM, bridged interfaces, etc.), - When console input is asked for (destroying a VM, bridged interfaces, etc.),
keystrokes such as ctrl-D and ctrl-C are more gracefully handled. [GH-1017] keystrokes such as ctrl-D and ctrl-C are more gracefully handled. [GH-1017]
- Fixed bug where port check would use "localhost" on systems where
"localhost" is not available. [GH-1057]
## 1.0.3 (May 1, 2012) ## 1.0.3 (May 1, 2012)

View File

@ -33,7 +33,7 @@ module Vagrant
hostport = options[:hostport].to_i hostport = options[:hostport].to_i
hostport = current[options[:name]] if current.has_key?(options[:name]) hostport = current[options[:name]] if current.has_key?(options[:name])
if existing.include?(hostport) || is_port_open?("localhost", hostport) if existing.include?(hostport) || is_port_open?("127.0.0.1", hostport)
# We have a collision! Handle it # We have a collision! Handle it
send("handle_#{handler}".to_sym, options, existing) send("handle_#{handler}".to_sym, options, existing)
end end