diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index 52164b462bb..f0717805a57 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -21,6 +21,7 @@ module Builtin autoload :NFS, "vagrant/action/builtin/nfs" 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 99ed32f54ea..b40714fd508 100644 --- a/lib/vagrant/action/builtin/provision.rb +++ b/lib/vagrant/action/builtin/provision.rb @@ -71,7 +71,21 @@ def run_provisioner(env, name, p) 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 00000000000..70cbc38932d --- /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