Provisioner built-in uses new API

This commit is contained in:
Mitchell Hashimoto 2013-01-13 16:09:32 -08:00
parent 84c45a854c
commit 5c9f27626c
2 changed files with 8 additions and 5 deletions

View File

@ -18,11 +18,14 @@ module Vagrant
def call(env) def call(env)
# Get all the configured provisioners # Get all the configured provisioners
provisioners = env[:machine].config.vm.provisioners.map do |provisioner| provisioners = env[:machine].config.vm.provisioners.map do |provisioner|
provisioner.provisioner.new(env, provisioner.config) klass = Vagrant.plugin("2").manager.provisioners[provisioner.name]
klass.new(env[:machine], provisioner.config)
end end
# Instantiate and prepare them. # Ask the provisioners to modify the configuration if needed
provisioners.map { |p| p.prepare } provisioners.each do |p|
p.configure(env[:machine].config)
end
# Continue, we need the VM to be booted. # Continue, we need the VM to be booted.
@app.call(env) @app.call(env)
@ -32,7 +35,7 @@ module Vagrant
env[:ui].info(I18n.t("vagrant.actions.vm.provision.beginning", env[:ui].info(I18n.t("vagrant.actions.vm.provision.beginning",
:provisioner => p.class)) :provisioner => p.class))
p.provision! p.provision
end end
end end
end end

View File

@ -56,8 +56,8 @@ module VagrantPlugins
b.use CleanMachineFolder b.use CleanMachineFolder
b.use ClearForwardedPorts b.use ClearForwardedPorts
b.use EnvSet, :port_collision_handler => :correct b.use EnvSet, :port_collision_handler => :correct
b.use CheckPortCollisions
b.use Provision b.use Provision
b.use CheckPortCollisions
b.use PruneNFSExports b.use PruneNFSExports
b.use NFS b.use NFS
b.use ClearSharedFolders b.use ClearSharedFolders