Pass machine to provider capabilities

This commit is contained in:
sophia 2022-06-29 10:38:39 -05:00
parent 52d37217ac
commit 73801703e7
2 changed files with 11 additions and 1 deletions

View File

@ -38,7 +38,7 @@ module Vagrant
# @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)
client.capability(cap_name, @machine, *args)
end
# Tests whether the given capability is possible.

View File

@ -140,6 +140,16 @@ module VagrantPlugins
machine.env.action_runner.run(callable, env)
end
def capability_arguments(args)
target, direct = args
nargs = direct.args.dup
if !nargs.first.is_a?(Vagrant::Machine)
nargs.unshift(mapper.map(target, to: Vagrant::Machine))
end
nargs
end
def load_provider(klass, machine)
key = cache.key(klass, machine)
return cache.get(key) if cache.registered?(key)