diff --git a/CHANGELOG.md b/CHANGELOG.md index f48081bfa..f7c0ec24e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ BUG FIXES: - Attempt to re-establish SSH connection on `Net::SSH::Disconnect` - Allow any value that can convert to a string for `Vagrant.plugin` - Chef solo `recipe_url` works properly again. [GH-1467] + - Port collision detection works properly in VirtualBox with + auto-corrected ports. [GH-1472] ## 1.1.2 (March 18, 2013) diff --git a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb index a69769a59..b33d2e4eb 100644 --- a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +++ b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb @@ -32,7 +32,7 @@ module Vagrant end def call(env) - @logger.debug("Detecting any forwarded port collisions...") + @logger.info("Detecting any forwarded port collisions...") # Get the extra ports we consider in use extra_in_use = env[:port_collision_extra_in_use] || [] @@ -43,6 +43,11 @@ module Vagrant # Determine the handler we'll use if we have any port collisions repair = !!env[:port_collision_repair] + # Log out some of our parameters + @logger.debug("Extra in use: #{extra_in_use.inspect}") + @logger.debug("Remap: #{remap.inspect}") + @logger.debug("Repair: #{repair.inspect}") + # Determine a list of usable ports for repair usable_ports = Set.new(env[:machine].config.vm.usable_port_range) usable_ports.subtract(extra_in_use) diff --git a/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb b/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb index 52836f42f..7fad5ee1e 100644 --- a/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb +++ b/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb @@ -21,7 +21,7 @@ module VagrantPlugins # If the ID matches the name of the forwarded port, then # remap. if options[:id] == name - remap[name] = hostport + remap[options[:host]] = hostport break end end