Remove the action registry feature.
This can be removed since in the future all actions will come from the providers or something. There are still issues with box actions but we'll get back to that later...
This commit is contained in:
parent
44b4b9dfef
commit
2ef20586da
|
@ -95,12 +95,6 @@ module Vagrant
|
||||||
c.register([:"1", :provider]) { Plugin::V1::Provider }
|
c.register([:"1", :provider]) { Plugin::V1::Provider }
|
||||||
c.register([:"1", :provisioner]) { Plugin::V1::Provisioner }
|
c.register([:"1", :provisioner]) { Plugin::V1::Provisioner }
|
||||||
|
|
||||||
# Returns a `Vagrant::Registry` object that contains all the built-in
|
|
||||||
# middleware stacks.
|
|
||||||
def self.actions
|
|
||||||
@actions ||= Vagrant::Action::Builtin.new
|
|
||||||
end
|
|
||||||
|
|
||||||
# The source root is the path to the root directory of
|
# The source root is the path to the root directory of
|
||||||
# the Vagrant gem.
|
# the Vagrant gem.
|
||||||
def self.source_root
|
def self.source_root
|
||||||
|
|
|
@ -10,8 +10,7 @@ module Vagrant
|
||||||
class Runner
|
class Runner
|
||||||
@@reported_interrupt = false
|
@@reported_interrupt = false
|
||||||
|
|
||||||
def initialize(registry, globals=nil, &block)
|
def initialize(globals=nil, &block)
|
||||||
@registry = registry
|
|
||||||
@globals = globals || {}
|
@globals = globals || {}
|
||||||
@lazy_globals = block
|
@lazy_globals = block
|
||||||
@logger = Log4r::Logger.new("vagrant::action::runner")
|
@logger = Log4r::Logger.new("vagrant::action::runner")
|
||||||
|
@ -20,7 +19,6 @@ module Vagrant
|
||||||
def run(callable_id, options=nil)
|
def run(callable_id, options=nil)
|
||||||
callable = callable_id
|
callable = callable_id
|
||||||
callable = Builder.new.use(callable_id) if callable_id.kind_of?(Class)
|
callable = Builder.new.use(callable_id) if callable_id.kind_of?(Class)
|
||||||
callable = registry_sequence(callable_id) if callable_id.kind_of?(Symbol)
|
|
||||||
raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call)
|
raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call)
|
||||||
|
|
||||||
# Create the initial environment with the options given
|
# Create the initial environment with the options given
|
||||||
|
@ -48,28 +46,6 @@ module Vagrant
|
||||||
@logger.info("Running action: #{callable_id}")
|
@logger.info("Running action: #{callable_id}")
|
||||||
Util::Busy.busy(int_callback) { callable.call(environment) }
|
Util::Busy.busy(int_callback) { callable.call(environment) }
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def registry_sequence(id)
|
|
||||||
# Attempt to get the sequence
|
|
||||||
seq = @registry.get(id)
|
|
||||||
return nil if !seq
|
|
||||||
|
|
||||||
# Go through all the registered plugins and get all the hooks
|
|
||||||
# for this sequence.
|
|
||||||
Vagrant.plugin("1").registered.each do |plugin|
|
|
||||||
hooks = plugin.action_hook(Vagrant::Plugin::V1::Plugin::ALL_ACTIONS)
|
|
||||||
hooks += plugin.action_hook(id)
|
|
||||||
|
|
||||||
hooks.each do |hook|
|
|
||||||
hook.call(seq)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Return the sequence
|
|
||||||
seq
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -205,7 +205,7 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @return [Action::Runner]
|
# @return [Action::Runner]
|
||||||
def action_runner
|
def action_runner
|
||||||
@action_runner ||= Action::Runner.new(action_registry) do
|
@action_runner ||= Action::Runner.new do
|
||||||
{
|
{
|
||||||
:action_runner => action_runner,
|
:action_runner => action_runner,
|
||||||
:box_collection => boxes,
|
:box_collection => boxes,
|
||||||
|
@ -218,16 +218,6 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Action registry for registering new actions with this environment.
|
|
||||||
#
|
|
||||||
# @return [Registry]
|
|
||||||
def action_registry
|
|
||||||
# For now we return the global built-in actions registry. In the future
|
|
||||||
# we may want to create an isolated registry that inherits from this
|
|
||||||
# global one, but for now there isn't a use case that calls for it.
|
|
||||||
Vagrant.actions
|
|
||||||
end
|
|
||||||
|
|
||||||
# Loads on initial access and reads data from the global data store.
|
# Loads on initial access and reads data from the global data store.
|
||||||
# The global data store is global to Vagrant everywhere (in every environment),
|
# The global data store is global to Vagrant everywhere (in every environment),
|
||||||
# so it can be used to store system-wide information. Note that "system-wide"
|
# so it can be used to store system-wide information. Note that "system-wide"
|
||||||
|
|
Loading…
Reference in New Issue