Do not reload VM and everything if no forwarded ports were destroyed
This commit is contained in:
parent
b00442026f
commit
97facb08fd
|
@ -67,10 +67,12 @@ module Vagrant
|
|||
end
|
||||
|
||||
def clear
|
||||
logger.info "Deleting any previously set forwarded ports..."
|
||||
fp = @runner.vm.forwarded_ports.dup
|
||||
fp.collect { |p| p.destroy }
|
||||
@runner.reload!
|
||||
if runner.vm.forwarded_ports.length > 0
|
||||
logger.info "Deleting any previously set forwarded ports..."
|
||||
fp = runner.vm.forwarded_ports.dup
|
||||
fp.collect { |p| p.destroy }
|
||||
runner.reload!
|
||||
end
|
||||
end
|
||||
|
||||
def forward_ports
|
||||
|
|
|
@ -164,9 +164,15 @@ class ForwardPortsActionTest < Test::Unit::TestCase
|
|||
forwarded_ports << port
|
||||
end
|
||||
|
||||
@vm.expects(:forwarded_ports).returns(forwarded_ports)
|
||||
@vm.stubs(:forwarded_ports).returns(forwarded_ports)
|
||||
@runner.expects(:reload!)
|
||||
@action.clear
|
||||
end
|
||||
|
||||
should "do nothing if there are no forwarded ports" do
|
||||
@vm.stubs(:forwarded_ports).returns([])
|
||||
@runner.expects(:reload!).never
|
||||
@action.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue