diff --git a/plugins/commands/serve/service/capability_platform_service.rb b/plugins/commands/serve/service/capability_platform_service.rb index d1ce90b8e..f9b4289d4 100644 --- a/plugins/commands/serve/service/capability_platform_service.rb +++ b/plugins/commands/serve/service/capability_platform_service.rb @@ -53,33 +53,21 @@ module VagrantPlugins end def capability_spec(req, ctx) - with_info(ctx) do |info| - cap_name = req.name.to_sym - plugin_name = info.plugin_name.to_sym - logger.debug("generating capabillity spec for #{cap_name} capability in #{plugin_name}") - caps_registry = @capabilities[plugin_name] - - target_cap = caps_registry.get(cap_name) - args = target_cap.method(cap_name).parameters - # The first argument is always a machine, drop it - args.shift - - cap_args = @default_args - - # TODO: take the rest of `args` and create entries for them in - # `cap_args` - - return SDK::FuncSpec.new( - name: "has_capability_spec", - args: cap_args, - result: [ - SDK::FuncSpec::Value.new( - type: "hashicorp.vagrant.sdk.Platform.Capability.Resp", - name: "", - ), - ], - ) - end + SDK::FuncSpec.new( + name: "capability_spec", + args: [ + SDK::FuncSpec::Value.new( + type: "hashicorp.vagrant.sdk.Args.Direct", + name: "", + ) + ], + result: [ + SDK::FuncSpec::Value.new( + type: "hashicorp.vagrant.sdk.Platform.Capability.Resp", + name: "", + ) + ] + ) end def capability(req, ctx) @@ -90,12 +78,15 @@ module VagrantPlugins caps_registry = @capabilities[plugin_name] target_cap = caps_registry.get(cap_name) - # TODO: how to all the args to pass into the cap method + # TODO: this needs to be adjusted to only be + # provided during mapping + mapper.add_argument(broker) + args = mapper.funcspec_map(req.func_args) cap_method = target_cap.method(cap_name) # TODO: pass in args too - resp = cap_method.call({}) + resp = cap_method.call(*args) val = Google::Protobuf::Value.new val.from_ruby(resp)