Module for core plugin manager mappers
This commit is contained in:
parent
afc6d1c27d
commit
b40dde3797
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
41
plugins/commands/serve/mappers/core_plugin_manager.rb
Normal file
41
plugins/commands/serve/mappers/core_plugin_manager.rb
Normal 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
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user