diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index eec35987f..deafb4a49 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -20,6 +20,7 @@ module Vagrant autoload :Lock, "vagrant/action/builtin/lock" autoload :Provision, "vagrant/action/builtin/provision" autoload :ProvisionerCleanup, "vagrant/action/builtin/provisioner_cleanup" + autoload :ProvisionerRun, "vagrant/action/builtin/provisioner_run" autoload :SetHostname, "vagrant/action/builtin/set_hostname" autoload :SSHExec, "vagrant/action/builtin/ssh_exec" autoload :SSHRun, "vagrant/action/builtin/ssh_run" diff --git a/lib/vagrant/action/builtin/provision.rb b/lib/vagrant/action/builtin/provision.rb index b0e08ece6..6d21fe7f6 100644 --- a/lib/vagrant/action/builtin/provision.rb +++ b/lib/vagrant/action/builtin/provision.rb @@ -78,7 +78,21 @@ module Vagrant env[:ui].info(I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => name)) - p.provision + callable = Builder.new.tap { |b| b.use ProvisionerRun, p } + action_runner.run(callable, + :action_name => :provisioner_run, + :provider_name => name + ) + end + + def action_runner + @action_runner ||= Action::Runner.new do + { + :env => @env[:env], + :machine => @env[:machine], + :ui => @env[:ui] + } + end end end end diff --git a/lib/vagrant/action/builtin/provisioner_run.rb b/lib/vagrant/action/builtin/provisioner_run.rb new file mode 100644 index 000000000..70cbc3893 --- /dev/null +++ b/lib/vagrant/action/builtin/provisioner_run.rb @@ -0,0 +1,21 @@ +require "log4r" + +module Vagrant + module Action + module Builtin + # This action is basically a wrapper on top of provisioner runs that + # enable plugins to hook around the provisioning itself + class ProvisionerRun + def initialize(app, env, provisioner) + @app = app + @provisioner = provisioner + end + + def call(env) + @app.call(env) + @provisioner.provision + end + end + end + end +end