diff --git a/lib/vagrant/actions/vm/customize.rb b/lib/vagrant/actions/vm/customize.rb index 84496ac87..c3e5fe816 100644 --- a/lib/vagrant/actions/vm/customize.rb +++ b/lib/vagrant/actions/vm/customize.rb @@ -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 diff --git a/test/vagrant/actions/vm/customize_test.rb b/test/vagrant/actions/vm/customize_test.rb index 21589e6d0..dfddc29e8 100644 --- a/test/vagrant/actions/vm/customize_test.rb +++ b/test/vagrant/actions/vm/customize_test.rb @@ -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