From 14d17dfd9dfe9d55acaaf6560cd61ef8b62b605f Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 1 Sep 2021 11:45:27 -0500 Subject: [PATCH] Return capability execution result --- lib/vagrant/host/remote.rb | 5 ----- plugins/commands/serve/client/capability_platform.rb | 3 ++- .../commands/serve/service/capability_platform_service.rb | 8 +++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/vagrant/host/remote.rb b/lib/vagrant/host/remote.rb index 45f0bda2f..a5abd2c4f 100644 --- a/lib/vagrant/host/remote.rb +++ b/lib/vagrant/host/remote.rb @@ -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 diff --git a/plugins/commands/serve/client/capability_platform.rb b/plugins/commands/serve/client/capability_platform.rb index f5dee511c..79fefea7d 100644 --- a/plugins/commands/serve/client/capability_platform.rb +++ b/plugins/commands/serve/client/capability_platform.rb @@ -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 diff --git a/plugins/commands/serve/service/capability_platform_service.rb b/plugins/commands/serve/service/capability_platform_service.rb index 8f40e88f5..e39e52f42 100644 --- a/plugins/commands/serve/service/capability_platform_service.rb +++ b/plugins/commands/serve/service/capability_platform_service.rb @@ -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