core: Add support for plugins to hook into the environment load process before configurations are parsed

This commit is contained in:
Fabio Rehm 2013-10-18 18:37:29 -03:00
parent a92e03cf4c
commit bbe7b3ffc5
1 changed files with 6 additions and 2 deletions

View File

@ -131,6 +131,10 @@ module Vagrant
# Load the plugins # Load the plugins
load_plugins load_plugins
# Call the hooks that does not require configurations to be loaded
# by using a "clean" action runner
hook(:environment_plugins_loaded, Action::Runner.new)
# Call the environment load hooks # Call the environment load hooks
hook(:environment_load) hook(:environment_load)
end end
@ -268,10 +272,10 @@ module Vagrant
# against the given name will be run in the context of this environment. # against the given name will be run in the context of this environment.
# #
# @param [Symbol] name Name of the hook. # @param [Symbol] name Name of the hook.
def hook(name) def hook(name, runner = action_runner)
@logger.info("Running hook: #{name}") @logger.info("Running hook: #{name}")
callable = Action::Builder.new callable = Action::Builder.new
action_runner.run( runner.run(
callable, callable,
:action_name => name, :action_name => name,
:env => self) :env => self)