Fix some issues to get hooks working

This commit is contained in:
Mitchell Hashimoto 2013-02-06 15:42:48 -08:00
parent b20dcc9eb8
commit 352fec0359
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,6 @@
require 'log4r'
require 'vagrant/action/hook'
require 'vagrant/util/busy'
# TODO:
@ -31,13 +32,13 @@ module Vagrant
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|
environment[: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.")
@logger.info("#{environment[:action_hooks].length} hooks defined.")
end
# Run the action chain in a busy block, marking the environment as

View File

@ -18,11 +18,13 @@ module Vagrant
#
# @return [Array]
def action_hooks
[].tap do |result|
result = []
@registered.each do |plugin|
result += plugin.components.action_hooks
end
end
result
end
# This returns all the registered commands.