Extract core plugin manager from context

This commit is contained in:
sophia 2022-03-28 13:45:48 -05:00 committed by Paul Hinze
parent 68ffb3a8cf
commit afc6d1c27d
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 21 additions and 2 deletions

View File

@ -10,6 +10,9 @@ module Vagrant
class << self
# @return [VagrantPlugins::Command::Serve::Client::PluginManager] remote manager client
attr_accessor :client
# @return [VagrantPlugins::Command::Serve::Client::CorePluginManager] remote manager client for core plugins
attr_accessor :core_client
end
# This wrapper class is used for encapsulating a remote plugin class. This
@ -140,6 +143,12 @@ module Vagrant
self.class.client
end
# @return [VagrantPlugins::Command::Serve::Client::CorePluginManager] remote core manager client
def core_plugin_manager
@logger.debug("Returning core plugin manager client #{self.class.core_client}")
self.class.core_client
end
# Synced folder plugins are registered with an integer priority, but in
# remote mode this is all captured by InternalService#get_plugins and
# handled on the Go sidw. Within the remote manager we return a stub

View File

@ -35,8 +35,11 @@ module Vagrant
@_remote_manager ||= Remote::Manager.new(local_manager)
end
def self.enable_remote_manager(client)
def self.enable_remote_manager(client, core_client: nil)
LOGGER.debug("enablinge remote manager with client: #{client}")
LOGGER.debug("enablinge remote manager with core client: #{core_client}")
Remote::Manager.client = client
Remote::Manager.core_client = core_client
@manager = remote_manager
end

View File

@ -30,7 +30,14 @@ module VagrantPlugins
context.metadata["plugin_manager"],
broker: info.broker
)
Vagrant.plugin("2").enable_remote_manager(client)
core_client = nil
if context.metadata["core_plugin_manager"]
core_client = Client::CorePluginManager.load(
context.metadata["core_plugin_manager"],
broker: info.broker
)
end
Vagrant.plugin("2").enable_remote_manager(client, core_client: core_client)
end
end
Thread.current.thread_variable_set(:service_info, info)