Add expected types for funcspec maps
This commit is contained in:
parent
8310e1bf95
commit
917ac04ef1
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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}"
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user