Provision command checks if VM is created
This commit is contained in:
parent
f4ab30238a
commit
b84123dcd9
|
@ -16,7 +16,7 @@ module Vagrant
|
|||
return # for tests
|
||||
end
|
||||
|
||||
if vm.vm.running?
|
||||
if vm.created? && vm.vm.running?
|
||||
vm.provision
|
||||
else
|
||||
vm.env.logger.info "VM '#{name}' not running. Ignoring provision request."
|
||||
|
|
|
@ -18,6 +18,7 @@ class CommandsProvisionTest < Test::Unit::TestCase
|
|||
setup do
|
||||
@foo_vm = mock("vm")
|
||||
@foo_vm.stubs(:env).returns(@env)
|
||||
@foo_vm.stubs(:created?).returns(true)
|
||||
|
||||
@vm_for_real = mock("vm for real")
|
||||
@foo_vm.stubs(:vm).returns(@vm_for_real)
|
||||
|
@ -45,6 +46,15 @@ class CommandsProvisionTest < Test::Unit::TestCase
|
|||
@foo_vm.expects(:provision).never
|
||||
@instance.execute(["foo"])
|
||||
end
|
||||
|
||||
should "do log to info if it's not created" do
|
||||
logger = mock("logger")
|
||||
logger.expects(:info)
|
||||
@env.stubs(:logger).returns(logger)
|
||||
@foo_vm.stubs(:created?).returns(false)
|
||||
@foo_vm.expects(:provision).never
|
||||
@instance.execute(["foo"])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue