Module for core plugin manager mappers

This commit is contained in:
sophia 2022-03-28 15:25:49 -05:00 committed by Paul Hinze
parent afc6d1c27d
commit b40dde3797
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
4 changed files with 42 additions and 38 deletions

View File

@ -36,8 +36,6 @@ module Vagrant
end
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

View File

@ -372,6 +372,7 @@ require Vagrant.source_root.join("plugins/commands/serve/mappers/box.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/capabilities.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/command.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/communicator.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/core_plugin_manager.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/direct.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/duration.rb").to_s
require Vagrant.source_root.join("plugins/commands/serve/mappers/environment.rb").to_s

View File

@ -0,0 +1,41 @@
module VagrantPlugins
module CommandServe
class Mappers
class CorePluginManagerFromProto < Mapper
def initialize
super(
inputs: [
Input.new(type: SDK::Args::CorePluginManager),
Input.new(type: Broker),
],
output: Client::CorePluginManager,
func: method(:converter)
)
end
def converter(proto, broker)
Client::CorePluginManager.load(proto, broker: broker)
end
end
class CorePluginManagerProtoFromSpec < Mapper
def initialize
super(
inputs: [Input.new(type: SDK::FuncSpec::Value) { |arg|
arg.type == "hashicorp.vagrant.sdk.Args.CorePluginManager" &&
!arg&.value&.value.nil?
}
],
output: SDK::Args::CorePluginManager,
func: method(:converter),
)
end
def converter(fv)
SDK::Args::CorePluginManager.decode(fv.value.value)
end
end
end
end
end

View File

@ -17,42 +17,6 @@ module VagrantPlugins
Client::PluginManager.load(proto, broker: broker)
end
end
class CorePluginManagerFromProto < Mapper
def initialize
super(
inputs: [
Input.new(type: SDK::Args::CorePluginManager),
Input.new(type: Broker),
],
output: Client::CorePluginManager,
func: method(:converter)
)
end
def converter(proto, broker)
Client::CorePluginManager.load(proto, broker: broker)
end
end
class CorePluginManagerProtoFromSpec < Mapper
def initialize
super(
inputs: [Input.new(type: SDK::FuncSpec::Value) { |arg|
arg.type == "hashicorp.vagrant.sdk.Args.CorePluginManager" &&
!arg&.value&.value.nil?
}
],
output: SDK::Args::CorePluginManager,
func: method(:converter),
)
end
def converter(fv)
SDK::Args::CorePluginManager.decode(fv.value.value)
end
end
end
end
end