Merge pull request #306 from hashicorp/fix-capability-boolean-handling

Fix Type::Booleans leaking through capabilities
This commit is contained in:
Paul Hinze 2022-07-07 14:21:05 -05:00 committed by GitHub
commit 59a8e9bb0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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