Merge pull request #297 from hashicorp/port-command-fix
Use remote provider
This commit is contained in:
commit
0b53e06687
@ -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
|
||||
|
||||
|
||||
@ -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}")
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user