From 4254b35b7d884877a5e91f234978c30e742731c4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 27 Feb 2013 13:40:11 -0800 Subject: [PATCH] Fix the forward port collision handling --- .../action/builtin/handle_forwarded_port_collisions.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb index 6a03b6a77..505461b5b 100644 --- a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +++ b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb @@ -48,12 +48,12 @@ module Vagrant usable_ports.subtract(extra_in_use) # Pass one, remove all defined host ports from usable ports - with_forwarded_ports do |args| + with_forwarded_ports(env) do |args| usable_ports.delete(args[1]) end # Pass two, detect/handle any collisions - with_forwarded_ports do |args| + with_forwarded_ports(env) do |args| guest_port = args[0] host_port = args[1] @@ -97,11 +97,13 @@ module Vagrant :new_port => repaired_port.to_s)) end end + + @app.call(env) end protected - def with_forwarded_ports + def with_forwarded_ports(env) env[:machine].config.vm.networks.each do |type, args| # Ignore anything but forwarded ports next if type != :forwarded_port