From 73801703e75ed415cc620af97fe75f75f84fd2c3 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 29 Jun 2022 10:38:39 -0500 Subject: [PATCH] Pass machine to provider capabilities --- lib/vagrant/plugin/remote/provider.rb | 2 +- plugins/commands/serve/service/provider_service.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/plugin/remote/provider.rb b/lib/vagrant/plugin/remote/provider.rb index 6eb8c7f85..5cb58e749 100644 --- a/lib/vagrant/plugin/remote/provider.rb +++ b/lib/vagrant/plugin/remote/provider.rb @@ -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. diff --git a/plugins/commands/serve/service/provider_service.rb b/plugins/commands/serve/service/provider_service.rb index b0a9fd174..9c59a7b3c 100644 --- a/plugins/commands/serve/service/provider_service.rb +++ b/plugins/commands/serve/service/provider_service.rb @@ -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)