diff --git a/config/default.rb b/config/default.rb index c7405eea5..44989c6c0 100644 --- a/config/default.rb +++ b/config/default.rb @@ -22,6 +22,7 @@ Vagrant::Config.run do |config| config.package.delimiter = 'VAGRANT' config.package.delimiter_regex = /(.*)#{config.package.delimiter}(.+)#{config.package.delimiter}(.*[\n\r])/ + config.chef.enabled = false config.chef.cookbooks_path = "cookbooks" config.chef.provisioning_path = "/tmp/vagrant-chef" config.chef.json = { diff --git a/lib/vagrant/actions/up.rb b/lib/vagrant/actions/up.rb index 9cf4cf097..f4910c3d9 100644 --- a/lib/vagrant/actions/up.rb +++ b/lib/vagrant/actions/up.rb @@ -4,7 +4,8 @@ module Vagrant def prepare # Up is a "meta-action" so it really just queues up a bunch # of other actions in its place: - steps = [Import, ForwardPorts, SharedFolders, Start, Provision] + steps = [Import, ForwardPorts, SharedFolders, Start] + steps << Provision if Vagrant.config.chef.enabled steps.insert(1, MoveHardDrive) if Vagrant.config.vm.hd_location steps.each do |action_klass| diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 9dcb94043..c420703d3 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -87,6 +87,11 @@ module Vagrant attr_accessor :cookbooks_path attr_accessor :provisioning_path attr_accessor :json + attr_accessor :enabled + + def initialize + @enabled = false + end end class VagrantConfig < Base diff --git a/test/vagrant/actions/up_test.rb b/test/vagrant/actions/up_test.rb index da849fd4d..c323124ef 100644 --- a/test/vagrant/actions/up_test.rb +++ b/test/vagrant/actions/up_test.rb @@ -8,7 +8,7 @@ class UpActionTest < Test::Unit::TestCase context "sub-actions" do setup do - @default_order = [Vagrant::Actions::Import, Vagrant::Actions::ForwardPorts, Vagrant::Actions::SharedFolders, Vagrant::Actions::Start, Vagrant::Actions::Provision] + @default_order = [Vagrant::Actions::Import, Vagrant::Actions::ForwardPorts, Vagrant::Actions::SharedFolders, Vagrant::Actions::Start] end def setup_action_expectations @@ -23,6 +23,16 @@ class UpActionTest < Test::Unit::TestCase @action.prepare end + should "add in the provisioning step if enabled" do + mock_config do |config| + config.chef.enabled = true + end + + @default_order.push(Vagrant::Actions::Provision) + setup_action_expectations + @action.prepare + end + should "add in the action to move hard drive if config is set" do mock_config do |config| File.expects(:directory?).with("foo").returns(true)