core: Allow hooking before and after provisioners
This commit is contained in:
parent
a92e03cf4c
commit
00ce442de8
|
@ -68,10 +68,30 @@ module Vagrant
|
|||
# subclass and implement custom behavior if they'd like around
|
||||
# this step.
|
||||
def run_provisioner(env, name, p)
|
||||
hook(:before_provisioner)
|
||||
|
||||
env[:ui].info(I18n.t("vagrant.actions.vm.provision.beginning",
|
||||
:provisioner => name))
|
||||
|
||||
p.provision
|
||||
|
||||
hook(:after_provisioner)
|
||||
end
|
||||
|
||||
def hook(name)
|
||||
@logger.info("Running hook: #{name}")
|
||||
callable = Action::Builder.new
|
||||
action_runner.run(callable, :action_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
|
||||
|
|
Loading…
Reference in New Issue