Setup hooks in the runner
This commit is contained in:
parent
aa7193471f
commit
b20dcc9eb8
|
@ -27,6 +27,19 @@ module Vagrant
|
|||
environment.merge!(@lazy_globals.call) if @lazy_globals
|
||||
environment.merge!(options || {})
|
||||
|
||||
# Setup the action hooks
|
||||
hooks = Vagrant.plugin("2").manager.action_hooks
|
||||
if !hooks.empty?
|
||||
@logger.info("Preparing hooks for middleware sequence...")
|
||||
env[:action_hooks] = hooks.map do |hook_proc|
|
||||
Hook.new.tap do |h|
|
||||
hook_proc.call(h)
|
||||
end
|
||||
end
|
||||
|
||||
@logger.info("#{env[:action_hooks].length} hooks defined.")
|
||||
end
|
||||
|
||||
# Run the action chain in a busy block, marking the environment as
|
||||
# interrupted if a SIGINT occurs, and exiting cleanly once the
|
||||
# chain has been run.
|
||||
|
|
|
@ -14,6 +14,17 @@ module Vagrant
|
|||
@registered = []
|
||||
end
|
||||
|
||||
# This returns all the action hooks.
|
||||
#
|
||||
# @return [Array]
|
||||
def action_hooks
|
||||
[].tap do |result|
|
||||
@registered.each do |plugin|
|
||||
result += plugin.components.action_hooks
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# This returns all the registered commands.
|
||||
#
|
||||
# @return [Hash]
|
||||
|
|
Loading…
Reference in New Issue