Fixes for provider capability invocations

It looks like I might have been the first to hit provider cabability
invocation in testing these changes, and so I found these few missing
methods on the client. They're just copied over from the other
capability hosts.

Calling capabilities on a provider also revealed that the wrong Machine
type was being pulled out of the funcspec args, so we had to correct
that too in order to get the capability calls working.
This commit is contained in:
Paul Hinze 2022-05-16 16:50:19 -05:00
parent e605132321
commit 02a06bca45
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 20 additions and 1 deletions

View File

@ -31,6 +31,25 @@ module Vagrant
client.action(@machine.to_proto, name)
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 provider 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 provider capability #{cap_name}")
client.has_capability?(cap_name)
end
def machine_id_changed
client.machine_id_changed(@machine.to_proto)
end

View File

@ -9,7 +9,7 @@ module VagrantPlugins
super
caps = Vagrant.plugin("2").local_manager.provider_capabilities
default_args = {
Client::Target::Machine => SDK::Args::Target::Machine
Vagrant::Machine => SDK::Args::Target::Machine
}
initialize_capability_platform!(caps, default_args)
end