Return capability execution result

This commit is contained in:
sophia 2021-09-01 11:45:27 -05:00 committed by Paul Hinze
parent 97baac8772
commit 14d17dfd9d
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 9 additions and 7 deletions

View File

@ -32,11 +32,6 @@ module Vagrant
# @param [Symbol] cap_name Name of the capability
def capability(cap_name, *args)
@logger.debug("running remote host capability #{cap_name} with args #{args}")
if !client.has_capability?(cap_name)
raise Errors::GuestCapabilityNotFound,
cap: cap_name.to_s,
guest: name
end
client.capability(cap_name, @env.to_proto, *args)
end

View File

@ -19,7 +19,8 @@ module VagrantPlugins
value: Google::Protobuf::Any.pack(val)
)]
)
res = client.has_capability(req)
res = @client.has_capability(req)
@logger.debug("got result #{res}")
res.has_capability

View File

@ -101,7 +101,13 @@ module VagrantPlugins
cap_method = target_cap.method(cap_name)
# TODO: pass in other args too
cap_method.call(machine)
resp = cap_method.call({})
val = Google::Protobuf::Value.new
val.from_ruby(resp)
SDK::Platform::Capability::Resp.new(
result: Google::Protobuf::Any.pack(val)
)
end
end
end