diff --git a/plugins/commands/serve/client/capability_platform.rb b/plugins/commands/serve/client/capability_platform.rb index 788efeb7e..fe4f9dbe5 100644 --- a/plugins/commands/serve/client/capability_platform.rb +++ b/plugins/commands/serve/client/capability_platform.rb @@ -35,15 +35,15 @@ module VagrantPlugins name: cap_name, ) ) - cb = proc do |name, args| + cb = lambda do |name, args| result = client.capability( SDK::Platform::Capability::NamedRequest.new( name: name, func_args: args, ) ) - return nil if result.nil? - mapper.map(result.result) + return nil if result.nil? || result.result.nil? + mapper.map(SDK::Args::Direct.new(arguments: [result.result])).arguments.first end [spec, cb] end diff --git a/plugins/commands/serve/util/direct_conversions.rb b/plugins/commands/serve/util/direct_conversions.rb index 27c7e1ea7..ff4861b24 100644 --- a/plugins/commands/serve/util/direct_conversions.rb +++ b/plugins/commands/serve/util/direct_conversions.rb @@ -373,7 +373,10 @@ end class Hashicorp::Vagrant::Sdk::Args::Direct def to_ruby VagrantPlugins::CommandServe::Type::Direct.new( - arguments: arguments.map(&:to_ruby) + arguments: arguments.map { |arg| + val = arg.to_ruby + val.is_a?(VagrantPlugins::CommandServe::Type) ? val.value : val + } ) end end