diff --git a/lib/vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb.rb b/lib/vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb.rb index 9e945440c..a511b0e5b 100644 --- a/lib/vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb.rb +++ b/lib/vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb.rb @@ -52,6 +52,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do add_message "hashicorp.vagrant.sdk.Args.Folder" do map :folders, :string, :message, 1, "google.protobuf.Any" end + add_message "hashicorp.vagrant.sdk.Args.TimeDuration" do + optional :duration, :int32, 1 + end add_message "hashicorp.vagrant.sdk.Args.TerminalUI" do optional :stream_id, :uint32, 1 optional :network, :string, 2 @@ -838,6 +841,7 @@ module Hashicorp Args::MetadataSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.MetadataSet").msgclass Args::Path = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Path").msgclass Args::Folder = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Folder").msgclass + Args::TimeDuration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.TimeDuration").msgclass Args::TerminalUI = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.TerminalUI").msgclass Args::Logger = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Logger").msgclass Args::JobInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.JobInfo").msgclass diff --git a/plugins/commands/serve/mappers/communicator.rb b/plugins/commands/serve/mappers/communicator.rb index a80ad0349..afd75707f 100644 --- a/plugins/commands/serve/mappers/communicator.rb +++ b/plugins/commands/serve/mappers/communicator.rb @@ -17,6 +17,24 @@ module VagrantPlugins SDK::Communicator::Command.decode(proto.value.value) end end + + class TimeDurationFromSpec < Mapper + def initialize + super( + inputs: [Input.new(type: SDK::FuncSpec::Value) { |arg| + arg.type == "hashicorp.vagrant.sdk.Args.TimeDuration" && + !arg&.value&.value.nil? + } + ], + output: SDK::Args::TimeDuration, + func: method(:converter), + ) + end + + def converter(fv) + SDK::Args::TimeDuration.decode(fv.value.value) + end + end end end end