Get the associated requested provider

This commit is contained in:
sophia 2021-01-07 17:14:36 -06:00 committed by Paul Hinze
parent 7a612698a5
commit a25381b03a
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 10 additions and 7 deletions

View File

@ -31,9 +31,14 @@ module Vagrant
)
resp_machine = @client.get_machine(req)
m = resp_machine.machine
provider_plugin = Vagrant.plugin("2").manager.providers[m.provider_name.to_sym]
provider_cls = provider_plugin[0]
provider_options = provider_plugin[1]
Machine.new(
m.name, m.provider_name, m.provider,
m.provider_config, m.provider_options, m.config,
m.name, m.provider_name, provider_cls,
m.provider_config, provider_options, m.config,
m.data_dir, m.box, m.env, m.vagrantfile,
base=false, client=@client
)
@ -186,8 +191,8 @@ module Vagrant
# Initializes the provider last so that it has access to all the
# state we setup on this machine.
# TODO: renable provider
# @provider = provider_cls.new(self)
# @provider._initialize(@provider_name, self)
@provider = provider_cls.new(self)
@provider._initialize(@provider_name, self)
# If we're using WinRM, we eager load the plugin because of
# GH-3390

View File

@ -35,14 +35,12 @@ module VagrantPlugins
end
def action_up(req, _unused_call)
LOG.debug("action up")
machine = machine_arg_to_machine(req)
LOG.debug(machine)
end
def machine_arg_to_machine(req)
raw_machine_arg = req.args[0].value.value
LOG.debug("decoding")
machine_arg = Hashicorp::Vagrant::Sdk::Args::Machine.decode(raw_machine_arg)
LOG.debug("machine id: " + machine_arg.machineId)
LOG.debug("server addr: " + machine_arg.serverAddr)
@ -50,11 +48,11 @@ module VagrantPlugins
mclient = Vagrant::MachineClient.new(machine_arg.serverAddr)
machine = mclient.get_machine(machine_arg.machineId)
LOG.debug("got machine: " + machine.name)
LOG.debug("using provider: " + machine.provider_name)
machine
end
def action_up_spec(req, _unused_call)
LOG.debug("action up spec")
args = [
Hashicorp::Vagrant::Sdk::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.Machine",