Add mapper for communicator command
This commit is contained in:
parent
4bc2a51748
commit
ce6b2c8338
@ -263,6 +263,7 @@ require Vagrant.source_root.join("plugins/commands/serve/mappers/basis.rb").to_s
|
||||
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/direct.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/environment.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/guest.rb").to_s
|
||||
|
||||
22
plugins/commands/serve/mappers/communicator.rb
Normal file
22
plugins/commands/serve/mappers/communicator.rb
Normal file
@ -0,0 +1,22 @@
|
||||
module VagrantPlugins
|
||||
module CommandServe
|
||||
class Mappers
|
||||
# Build a communicator command arguments from a FuncSpec value
|
||||
class CommunicatorCommandArgumentsFromSpec < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::FuncSpec::Value) { |arg|
|
||||
arg.type == "hashicorp.vagrant.sdk.Communicator.Command" &&
|
||||
!arg&.value&.value.nil?
|
||||
}
|
||||
end
|
||||
super(inputs: inputs, output: SDK::Communicator::Command, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto)
|
||||
SDK::Communicator::Command.decode(proto.value.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user