Don't run VM customizations if none were specified

This commit is contained in:
Mitchell Hashimoto 2010-06-03 20:32:09 -07:00
parent 50262cfb66
commit b00442026f
2 changed files with 13 additions and 5 deletions

View File

@ -3,13 +3,15 @@ module Vagrant
module VM
class Customize < Base
def execute!
logger.info "Running any VM customizations..."
if !runner.env.config.vm.proc_stack.empty?
logger.info "Running any VM customizations..."
# Run the customization procs over the VM
@runner.env.config.vm.run_procs!(@runner.vm)
# Run the customization procs over the VM
runner.env.config.vm.run_procs!(@runner.vm)
# Save the vm
@runner.vm.save
# Save the vm
runner.vm.save
end
end
end
end

View File

@ -7,9 +7,15 @@ class CustomizeActionTest < Test::Unit::TestCase
context "executing" do
should "run the VM customization procs then save the VM" do
@runner.env.config.vm.customize { |vm| }
@runner.env.config.vm.expects(:run_procs!).with(@vm)
@vm.expects(:save).once
@action.execute!
end
should "not run anything if no customize blocks exist" do
@vm.expects(:save).never
@action.execute!
end
end
end