Add expected types for funcspec maps

This commit is contained in:
Chris Roberts 2021-10-29 09:00:41 -07:00 committed by Paul Hinze
parent 8310e1bf95
commit 917ac04ef1
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
4 changed files with 9 additions and 8 deletions

View File

@ -54,12 +54,13 @@ module VagrantPlugins
with_info(ctx) do |info|
plugin_name = info.plugin_name
ui_client, env_client, arguments = mapper.funcspec_map(req.spec)
ui, env, arguments = mapper.funcspec_map(req.spec, expect: [Vagrant::UI::Remote, Vagrant::Environment, SDK::Command::Arguments])
ui = Vagrant::UI::Remote.new(ui_client)
env = Vagrant::Environment.new(
{ui: ui, client: env_client}
)
# ui = Vagrant::UI::Remote.new(ui_client)
# env = Vagrant::Environment.new(
# {ui: ui, client: env_client}
# )
plugin = Vagrant::Plugin::V2::Plugin.manager.commands[plugin_name.to_sym].to_a.first
if !plugin

View File

@ -40,7 +40,7 @@ module VagrantPlugins
def detect(req, ctx)
with_info(ctx) do |info|
plugin_name = info.plugin_name
target = mapper.funcspec_map(req)
target = mapper.funcspec_map(req, expect: Client::Target)
project = target.project
env = Vagrant::Environment.new({client: project})
machine = env.machine(target.name.to_sym, target.provider_name.to_sym)

View File

@ -39,7 +39,7 @@ module VagrantPlugins
def detect(req, ctx)
with_info(ctx) do |info|
plugin_name = info.plugin_name
statebag = mapper.funcspec_map(req)
statebag = mapper.funcspec_map(req, expect: Client::StateBag)
plugin = Vagrant.plugin("2").manager.hosts[plugin_name.to_s.to_sym].to_a.first
if !plugin
raise "Failed to locate host plugin for: #{plugin_name.inspect}"

View File

@ -40,7 +40,7 @@ module VagrantPlugins
def action_up(req, ctx)
with_info(ctx) do |info|
plugin_name = info.plugin_name
ui, machine = mapper.funcspec_map(req.spec)
ui, machine = mapper.funcspec_map(req.spec, expect: [Vagrant::UI::Remote, Vagrant::Machine])
machine = Client::Target::Machine.load(raw_machine, ui)
machine.ui.warn("hello from vagrant")