Accept options for actions on provider service

This commit is contained in:
Chris Roberts 2022-02-09 09:27:00 -08:00 committed by Paul Hinze
parent 38d7bcc51f
commit e2b135eb80
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -69,6 +69,10 @@ module VagrantPlugins
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.Direct",
name: "",
),
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.Options",
name: "",
)
],
result: []
@ -79,10 +83,11 @@ module VagrantPlugins
plugins = Vagrant.plugin("2").local_manager.providers
with_plugin(ctx, plugins, broker: broker) do |plugin|
action_name = req.name.to_sym
args = mapper.funcspec_map(
args, options = mapper.funcspec_map(
req.func_args,
expect: [Type::Direct]
)
options = Type::Options.new(value: {}) if options.nil?
machine = args.arguments.find { |a| a.is_a?(Vagrant::Machine) }
provider = plugin.new(machine)
@ -92,7 +97,7 @@ module VagrantPlugins
action: name,
provider: @provider.to_s
end
action_raw(machine, action_name, callable)
action_raw(machine, action_name, callable, options.value.to_h)
Empty.new
end
end