Port collision type mismatches fixed. [closes GH-185]
This commit is contained in:
parent
ebf1fa2fb1
commit
341e7916f4
|
@ -1,5 +1,6 @@
|
||||||
## 0.6.6 (unreleased)
|
## 0.6.6 (unreleased)
|
||||||
|
|
||||||
|
- Fix port collision handling with greater than two VMs. [GH-185]
|
||||||
- Fix potential infinite loop with root path if bad CWD is given to environment.
|
- Fix potential infinite loop with root path if bad CWD is given to environment.
|
||||||
|
|
||||||
## 0.6.5 (October 8, 2010)
|
## 0.6.5 (October 8, 2010)
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Vagrant
|
||||||
def external_collision_check
|
def external_collision_check
|
||||||
existing = used_ports
|
existing = used_ports
|
||||||
@env.env.config.vm.forwarded_ports.each do |name, options|
|
@env.env.config.vm.forwarded_ports.each do |name, options|
|
||||||
if existing.include?(options[:hostport].to_s)
|
if existing.include?(options[:hostport].to_i)
|
||||||
handle_collision(name, options, existing)
|
handle_collision(name, options, existing)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Vagrant
|
||||||
if vm.running? && vm.uuid != @env["vm"].uuid
|
if vm.running? && vm.uuid != @env["vm"].uuid
|
||||||
vm.network_adapters.collect do |na|
|
vm.network_adapters.collect do |na|
|
||||||
na.nat_driver.forwarded_ports.collect do |fp|
|
na.nat_driver.forwarded_ports.collect do |fp|
|
||||||
fp.hostport.to_s
|
fp.hostport.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ForwardPortsHelpersVMActionTest < Test::Unit::TestCase
|
||||||
na.stubs(:nat_driver).returns(ne)
|
na.stubs(:nat_driver).returns(ne)
|
||||||
ne.stubs(:forwarded_ports).returns(fps)
|
ne.stubs(:forwarded_ports).returns(fps)
|
||||||
@vms << mock_vm(:network_adapters => [na])
|
@vms << mock_vm(:network_adapters => [na])
|
||||||
assert_equal %W[2222 80], @instance.used_ports
|
assert_equal [2222, 80], @instance.used_ports
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,12 +53,12 @@ class ForwardPortsVMActionTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not raise any errors if no forwarded ports collide" do
|
should "not raise any errors if no forwarded ports collide" do
|
||||||
@used_ports << "80"
|
@used_ports << 80
|
||||||
assert_nothing_raised { @klass.new(@app, @env) }
|
assert_nothing_raised { @klass.new(@app, @env) }
|
||||||
end
|
end
|
||||||
|
|
||||||
should "handle collision if it happens" do
|
should "handle collision if it happens" do
|
||||||
@used_ports << "2222"
|
@used_ports << 2222
|
||||||
@klass.any_instance.expects(:handle_collision).with("ssh", anything, anything).once
|
@klass.any_instance.expects(:handle_collision).with("ssh", anything, anything).once
|
||||||
assert_nothing_raised { @klass.new(@app, @env) }
|
assert_nothing_raised { @klass.new(@app, @env) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue