diff --git a/lib/vagrant/machine/remote.rb b/lib/vagrant/machine/remote.rb index 225c96589..af41a883d 100644 --- a/lib/vagrant/machine/remote.rb +++ b/lib/vagrant/machine/remote.rb @@ -42,6 +42,7 @@ module Vagrant # TODO: get trigger config from go @triggers = Vagrant::Plugin::V2::Trigger.new(@env, @config.trigger, self, @ui) @provider_options = {} # @config.vm.get_provider_overrides(@provider_name) + @provider = Vagrant.plugin("2").manager.providers[provider_name].first.new(self) # Keep track of where our UUID should be placed @index_uuid_file = nil @@ -137,7 +138,7 @@ module Vagrant def provider return @provider if @provider - @provider = Vagrant.plugin("2").local_manager.providers[provider_name].first.new(self) + @provider = Vagrant.plugin("2").manager.providers[provider_name].first.new(self) @provider end diff --git a/lib/vagrant/plugin/remote/manager.rb b/lib/vagrant/plugin/remote/manager.rb index 3a4887408..e0883fe3a 100644 --- a/lib/vagrant/plugin/remote/manager.rb +++ b/lib/vagrant/plugin/remote/manager.rb @@ -92,7 +92,7 @@ module Vagrant klass = get_local_plugin return super if klass.nil? @logger.debug("found local plugin class #{self.class.name} -> #{klass.name}") - c = VagrantPlugins::CommandServe::Service.cache + c = VagrantPlugins::CommandServe.cache key = c.key(klass, *@init[0]) if !c.registered?(key) @logger.debug("creating new local plugin instance of #{klass} with args: #{@init}") 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/mappers/known_types.rb b/plugins/commands/serve/mappers/known_types.rb index ae94635f0..16ac9e619 100644 --- a/plugins/commands/serve/mappers/known_types.rb +++ b/plugins/commands/serve/mappers/known_types.rb @@ -171,7 +171,7 @@ module VagrantPlugins def converter(proto, mapper) begin - h = Hash.new.tap do |result| + Hash.new.tap do |result| proto.entries.each do |entry| # Convert our key and value to native types k = mapper.map(entry.key) @@ -183,7 +183,6 @@ module VagrantPlugins result[k] = v end end - Vagrant::Util::HashWithIndifferentAccess.new(h) rescue => err logger.error { "proto mapping to hash failed: #{err}" } raise diff --git a/plugins/commands/serve/service/provider_service.rb b/plugins/commands/serve/service/provider_service.rb index c05d8c34f..9c59a7b3c 100644 --- a/plugins/commands/serve/service/provider_service.rb +++ b/plugins/commands/serve/service/provider_service.rb @@ -110,7 +110,7 @@ module VagrantPlugins def state_spec(*_) funcspec( args: [ - SDK::Args::Target + SDK::Args::Target::Machine ], result: SDK::Args::Target::Machine::State, ) @@ -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)