From 42744f71e81bc7340fe02b7c5c95f194a6b8cf29 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 8 Aug 2012 20:02:18 -0700 Subject: [PATCH] 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. --- CHANGELOG.md | 2 ++ lib/vagrant/action/vm/check_port_collisions.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe848fcf2..ce535ac31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ using SCP to upload files. [GH-924] - 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] + - Fixed bug where port check would use "localhost" on systems where + "localhost" is not available. [GH-1057] ## 1.0.3 (May 1, 2012) diff --git a/lib/vagrant/action/vm/check_port_collisions.rb b/lib/vagrant/action/vm/check_port_collisions.rb index 254b351ad..95f6d4f2f 100644 --- a/lib/vagrant/action/vm/check_port_collisions.rb +++ b/lib/vagrant/action/vm/check_port_collisions.rb @@ -33,7 +33,7 @@ module Vagrant hostport = options[:hostport].to_i 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 send("handle_#{handler}".to_sym, options, existing) end