Move provisioning prepare up into the `call` method

This commit is contained in:
Mitchell Hashimoto 2011-07-06 22:50:49 -07:00
parent bdc316f4ef
commit 1de152ae36
2 changed files with 2 additions and 5 deletions

View File

@ -15,6 +15,7 @@ module Vagrant
enabled_provisioners.each do |instance| enabled_provisioners.each do |instance|
@env.ui.info I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => instance.class) @env.ui.info I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => instance.class)
instance.prepare
instance.provision! instance.provision!
end end
end end
@ -22,7 +23,6 @@ module Vagrant
def enabled_provisioners def enabled_provisioners
@env["config"].vm.provisioners.map do |provisioner| @env["config"].vm.provisioners.map do |provisioner|
instance = provisioner.provisioner.new(@env, provisioner.config) instance = provisioner.provisioner.new(@env, provisioner.config)
instance.prepare
instance instance
end end
end end

View File

@ -23,10 +23,6 @@ class ProvisionVMActionTest < Test::Unit::TestCase
end end
context "loading a provisioner" do context "loading a provisioner" do
setup do
Vagrant::Provisioners::ChefSolo.any_instance.expects(:prepare).at_least(0)
end
should "instantiate and prepare each provisioner" do should "instantiate and prepare each provisioner" do
@env["config"].vm.provision :chef_solo @env["config"].vm.provision :chef_solo
@env["config"].vm.provision :chef_solo @env["config"].vm.provision :chef_solo
@ -58,6 +54,7 @@ class ProvisionVMActionTest < Test::Unit::TestCase
@app.expects(:call).with(@env).in_sequence(seq) @app.expects(:call).with(@env).in_sequence(seq)
@instance.stubs(:enabled_provisioners).returns(provisioners) @instance.stubs(:enabled_provisioners).returns(provisioners)
provisioners.each do |prov| provisioners.each do |prov|
prov.expects(:prepare).in_sequence(seq)
prov.expects(:provision!).in_sequence(seq) prov.expects(:provision!).in_sequence(seq)
end end