From 94698704ab0e330242f99984e92df7ce126ce4ea Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 16 Feb 2022 12:12:04 -0600 Subject: [PATCH] Fix some small errors --- .../commands/serve/client/synced_folder.rb | 6 ++--- .../serve/service/provider_service.rb | 2 +- .../serve/service/synced_folder_service.rb | 25 ++++++++----------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/plugins/commands/serve/client/synced_folder.rb b/plugins/commands/serve/client/synced_folder.rb index ca2061b8a..897aae882 100644 --- a/plugins/commands/serve/client/synced_folder.rb +++ b/plugins/commands/serve/client/synced_folder.rb @@ -64,7 +64,7 @@ module VagrantPlugins def enable(machine, folders, opts) run_func(machine, Type::Folders.new(value: folders), - Type::Options.new(opts), + Type::Options.new(value: opts), ) end @@ -87,7 +87,7 @@ module VagrantPlugins def disable(machine, folders, opts) run_func(machine, Type::Folders.new(value: folders), - Type::Options.new(opts), + Type::Options.new(value: opts), ) end @@ -107,7 +107,7 @@ module VagrantPlugins # @param machine [Vagrant::Machine] Guest machine # @param opts [Hash] Options for folders def cleanup(machine, opts) - run_func(machine, Type::Options.new(opts)) + run_func(machine, Type::Options.new(value: opts)) end end end diff --git a/plugins/commands/serve/service/provider_service.rb b/plugins/commands/serve/service/provider_service.rb index 5ce8033e3..8729d7cf9 100644 --- a/plugins/commands/serve/service/provider_service.rb +++ b/plugins/commands/serve/service/provider_service.rb @@ -52,7 +52,7 @@ module VagrantPlugins ) end - def installed(*_) + def installed(req, ctx) plugins = Vagrant.plugin("2").local_manager.providers with_plugin(ctx, plugins, broker: broker) do |plugin| is_installed = plugin.installed? diff --git a/plugins/commands/serve/service/synced_folder_service.rb b/plugins/commands/serve/service/synced_folder_service.rb index 535fc7e47..d0b9b509f 100644 --- a/plugins/commands/serve/service/synced_folder_service.rb +++ b/plugins/commands/serve/service/synced_folder_service.rb @@ -39,17 +39,14 @@ module VagrantPlugins def usable(req, ctx) plugins = Vagrant.plugin("2").local_manager.synced_folders with_plugin(ctx, plugins, broker: broker) do |plugin| - target = mapper.funcspec_map(req) - project = target.project - env = Vagrant::Environment.new({client: project}) - machine = env.machine(target.name.to_sym, target.provider_name.to_sym) - + machine = mapper.funcspec_map( + req, expect: [Vagrant::Machine] + ) sf = plugin.new - usable = sf.usable?(machine) - logger.debug("usable: #{usable}") - SDK::SyncedFolder::UsableResp.new( - usable: usable, - ) + usable = sf.usable?(machine) + SDK::SyncedFolder::UsableResp.new( + usable: usable, + ) end end @@ -114,7 +111,7 @@ module VagrantPlugins plugins = Vagrant.plugin("2").local_manager.synced_folders with_plugin(ctx, plugins, broker: broker) do |plugin| machine, folders, opts = mapper.funcspec_map( - req.func_args, + req, expect: [Vagrant::Machine, Folders, Type::Options] ) # change the top level folders hash key to a string @@ -150,7 +147,7 @@ module VagrantPlugins plugins = Vagrant.plugin("2").local_manager.synced_folders with_plugin(ctx, plugins, broker: broker) do |plugin| machine, folders, opts = mapper.funcspec_map( - req.func_args, + req, expect: [Vagrant::Machine, Type::Folders, Type::Options] ) # change the top level folders hash key to a string @@ -182,11 +179,11 @@ module VagrantPlugins plugins = Vagrant.plugin("2").local_manager.synced_folders with_plugin(ctx, plugins, broker: broker) do |plugin| machine, opts = mapper.funcspec_map( - req.func_args, + req, expect: [Vagrant::Machine, Type::Options] ) - sf = get_synced_folder_plugin(plugin_name) + sf = plugin.new sf.cleanup(machine, opts.value) Empty.new end