Provisioning can now be enabled/disabled by configuration.

This commit is contained in:
Mitchell Hashimoto 2010-02-16 01:05:42 -08:00
parent 1b2bcfe72d
commit 05f4845509
4 changed files with 19 additions and 2 deletions

View File

@ -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 = {

View File

@ -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|

View File

@ -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

View File

@ -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)