From 82b2630a80b412f31f31632befa52ac76fdf7489 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 31 Jan 2020 09:00:27 -0800 Subject: [PATCH 1/2] Fixes #11358: Actually validate synced_folder type options Prior to this commit, Vagrant wouldn't validate the `type` option for any synced_folder configs defined. This commit updates that behavior to look at the current list of installed synced_folder plugins, and ensure if a type is defined, it's a valid plugin in that list. --- plugins/kernel_v2/config/vm.rb | 11 ++++++++--- templates/locales/en.yml | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 7c0e4e423..7abd9ee4b 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -755,9 +755,14 @@ module VagrantPlugins errors << I18n.t("vagrant.config.vm.shared_folder_mount_options_array") end - # One day remove this probably. - if options[:extra] - errors << "The 'extra' flag on synced folders is now 'mount_options'" + if options[:type] + plugins = Vagrant.plugin("2").manager.synced_folders + impl_class = plugins[options[:type]] + if !impl_class + errors << I18n.t("vagrant.config.vm.shared_folder_invalid_option_type", + type: options[:type], + options: plugins.keys.join(', ')) + end end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 72737a7b8..2f5a81467 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1943,6 +1943,12 @@ en: The shared folder guest path must be absolute: %{path} shared_folder_hostpath_missing: |- The host path of the shared folder is missing: %{path} + shared_folder_invalid_option_type: |- + The type '%{type}' is not a valid synced folder type. If 'type' is not + specified, Vagrant will automatically choose the best synced folder + option for your guest. Otherwise, please pick from the following valid options: + + %{options} shared_folder_nfs_owner_group: |- Shared folders that have NFS enabled do not support owner/group attributes. Host path: %{path} From fe8d8da99afb08c300e5ffb43578054420febb80 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 31 Jan 2020 09:36:29 -0800 Subject: [PATCH 2/2] Fixup: reword error message for type validation --- templates/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 2f5a81467..1d91de3f5 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1946,7 +1946,7 @@ en: shared_folder_invalid_option_type: |- The type '%{type}' is not a valid synced folder type. If 'type' is not specified, Vagrant will automatically choose the best synced folder - option for your guest. Otherwise, please pick from the following valid options: + option for your guest. Otherwise, please pick from the following available options: %{options} shared_folder_nfs_owner_group: |-