From b58b77ef0b37f308f3b66049a912558be2e93e33 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Oct 2021 12:58:44 -0500 Subject: [PATCH] Add capability methods for remote server --- lib/vagrant/machine/remote.rb | 3 ++- lib/vagrant/plugin/v2/synced_folder/remote.rb | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/machine/remote.rb b/lib/vagrant/machine/remote.rb index a9acfd8b1..ab1bb1e12 100644 --- a/lib/vagrant/machine/remote.rb +++ b/lib/vagrant/machine/remote.rb @@ -371,7 +371,8 @@ module Vagrant end def synced_folders - self.class.synced_folders(self) + # self.class.synced_folders(self) + client.synced_folders end def to_proto diff --git a/lib/vagrant/plugin/v2/synced_folder/remote.rb b/lib/vagrant/plugin/v2/synced_folder/remote.rb index 766ea6dd8..869c7f408 100644 --- a/lib/vagrant/plugin/v2/synced_folder/remote.rb +++ b/lib/vagrant/plugin/v2/synced_folder/remote.rb @@ -14,6 +14,7 @@ module Vagrant end def _initialize(machine, synced_folder_type) + @client = nil#TODO! self end @@ -54,6 +55,29 @@ module Vagrant def cleanup(machine, opts) client.cleanup(machine.to_proto, opts) end + + # Executes the capability with the given name, optionally passing more + # arguments onwards to the capability. If the capability returns a value, + # it will be returned. + # + # @param [Symbol] cap_name Name of the capability + def capability(cap_name, *args) + @logger.debug("running remote host capability #{cap_name} with args #{args}") + client.capability(cap_name, *args) + end + + # Tests whether the given capability is possible. + # + # @param [Symbol] cap_name Capability name + # @return [Boolean] + def capability?(cap_name) + @logger.debug("checking for remote host capability #{cap_name}") + client.has_capability?(cap_name) + end + + def to_proto + client.proto + end end end end