On import, only run destroy action if VM is created
This commit is contained in:
parent
7d73bec776
commit
714c94780c
|
@ -22,8 +22,10 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def recover(env)
|
def recover(env)
|
||||||
# Interrupted, destroy the VM
|
if env["vm"].created?
|
||||||
env["actions"].run(:destroy)
|
# Interrupted, destroy the VM
|
||||||
|
env["actions"].run(:destroy)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,11 +40,15 @@ class ImportVMActionTest < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "not run the destroy action on recover if VM is not created" do
|
||||||
|
@env.env.vm.stubs(:created?).returns(false)
|
||||||
|
@env.env.actions.expects(:run).never
|
||||||
|
@instance.recover(@env)
|
||||||
|
end
|
||||||
|
|
||||||
should "run the destroy action on recover" do
|
should "run the destroy action on recover" do
|
||||||
env = mock("env")
|
@env.env.vm.stubs(:created?).returns(true)
|
||||||
destroy = mock("destory")
|
@env.env.actions.expects(:run).with(:destroy).once
|
||||||
env.expects(:[]).with("actions").returns(destroy)
|
@instance.recover(@env)
|
||||||
destroy.expects(:run).with(:destroy)
|
|
||||||
@instance.recover(env)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue