Initial updates for direct to any mapping

This commit is contained in:
Chris Roberts 2021-10-29 09:07:43 -07:00 committed by Paul Hinze
parent a85c7cc097
commit 4a97d86b78
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -44,21 +44,28 @@ module VagrantPlugins
value: any,
)
end
any_args = args.map do |a|
if a.class.ancestors.include?(Google::Protobuf::MessageExts)
val = a
else
val = Google::Protobuf::Value.new
val.from_ruby(a)
end
Google::Protobuf::Any.pack(val)
end
d = Types::Direct.new(arguments: args)
da = mapper.map(d, mapper, to: SDK::Args::Direct) #Google::Protobuf::Any)
arg_protos << SDK::FuncSpec::Value.new(
name: "",
type: "hashicorp.vagrant.sdk.Args.Direct",
value: Google::Protobuf::Any.pack(SDK::Args::Direct.new(list: any_args)),
value: Google::Protobuf::Any.pack(da),
)
# any_args = args.map do |a|
# if a.class.ancestors.include?(Google::Protobuf::MessageExts)
# val = a
# else
# val = Google::Protobuf::Value.new
# val.from_ruby(a)
# end
# Google::Protobuf::Any.pack(val)
# end
# arg_protos << SDK::FuncSpec::Value.new(
# name: "",
# type: "hashicorp.vagrant.sdk.Args.Direct",
# value: Google::Protobuf::Any.pack(SDK::Args::Direct.new(list: any_args)),
# )
req = SDK::Platform::Capability::NamedRequest.new(
name: cap_name.to_s,