Don't persist shared folders if mount options capability not provided

This commit is contained in:
sophia 2020-08-19 14:59:25 -05:00
parent cd2d84fda7
commit 56fa014af8
2 changed files with 11 additions and 5 deletions

View File

@ -245,7 +245,7 @@ module Vagrant
def cached_synced_folders(machine)
import = JSON.parse(machine.data_dir.join("synced_folders").read)
import.each do |type, folders|
impl = plugins[type.to_sym].first.new._initialize(machine, type)
impl = plugins[type.to_sym].first.new._initialize(machine, type.to_sym)
folders.each { |_, v| v[:plugin] = impl }
end
# Symbolize the keys we want as symbols

View File

@ -23,12 +23,18 @@ module VagrantPlugins
ssh_info = machine.ssh_info
export_folders = folders.map { |type, folder|
folder.map { |name, data|
guest_path = Shellwords.escape(data[:guestpath])
data[:owner] ||= ssh_info[:username]
data[:group] ||= ssh_info[:username]
guest_path = Shellwords.escape(data[:guestpath])
mount_options, _, _ = data[:plugin].capability(
:mount_options, name, guest_path, data)
mount_type = data[:plugin].capability(:mount_type)
if data[:plugin].capability?(:mount_type)
mount_type = data[:plugin].capability(:mount_type)
mount_options, _, _ = data[:plugin].capability(
:mount_options, name, guest_path, data)
else
next
end
mount_options = "#{mount_options},nofail"
{
name: name,