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 = 'VAGRANT'
config.package.delimiter_regex = /(.*)#{config.package.delimiter}(.+)#{config.package.delimiter}(.*[\n\r])/ config.package.delimiter_regex = /(.*)#{config.package.delimiter}(.+)#{config.package.delimiter}(.*[\n\r])/
config.chef.enabled = false
config.chef.cookbooks_path = "cookbooks" config.chef.cookbooks_path = "cookbooks"
config.chef.provisioning_path = "/tmp/vagrant-chef" config.chef.provisioning_path = "/tmp/vagrant-chef"
config.chef.json = { config.chef.json = {

View File

@ -4,7 +4,8 @@ module Vagrant
def prepare def prepare
# Up is a "meta-action" so it really just queues up a bunch # Up is a "meta-action" so it really just queues up a bunch
# of other actions in its place: # 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.insert(1, MoveHardDrive) if Vagrant.config.vm.hd_location
steps.each do |action_klass| steps.each do |action_klass|

View File

@ -87,6 +87,11 @@ module Vagrant
attr_accessor :cookbooks_path attr_accessor :cookbooks_path
attr_accessor :provisioning_path attr_accessor :provisioning_path
attr_accessor :json attr_accessor :json
attr_accessor :enabled
def initialize
@enabled = false
end
end end
class VagrantConfig < Base class VagrantConfig < Base

View File

@ -8,7 +8,7 @@ class UpActionTest < Test::Unit::TestCase
context "sub-actions" do context "sub-actions" do
setup 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 end
def setup_action_expectations def setup_action_expectations
@ -23,6 +23,16 @@ class UpActionTest < Test::Unit::TestCase
@action.prepare @action.prepare
end 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 should "add in the action to move hard drive if config is set" do
mock_config do |config| mock_config do |config|
File.expects(:directory?).with("foo").returns(true) File.expects(:directory?).with("foo").returns(true)