Replace enable_nfs
and sync_opts
config with synced_folder_opts
This commit is contained in:
parent
125ae61394
commit
ef0a3f3fc9
2 changed files with 8 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Cachier
|
module Cachier
|
||||||
class Config < Vagrant.plugin(2, :config)
|
class Config < Vagrant.plugin(2, :config)
|
||||||
attr_accessor :scope, :auto_detect, :enable_nfs, :sync_opts
|
attr_accessor :scope, :auto_detect, :enable_nfs, :synced_folder_opts
|
||||||
attr_reader :buckets
|
attr_reader :buckets
|
||||||
|
|
||||||
ALLOWED_SCOPES = %w( box machine )
|
ALLOWED_SCOPES = %w( box machine )
|
||||||
|
@ -9,8 +9,7 @@ module VagrantPlugins
|
||||||
def initialize
|
def initialize
|
||||||
@scope = UNSET_VALUE
|
@scope = UNSET_VALUE
|
||||||
@auto_detect = UNSET_VALUE
|
@auto_detect = UNSET_VALUE
|
||||||
@enable_nfs = UNSET_VALUE
|
@synced_folder_opts = UNSET_VALUE
|
||||||
@sync_opts = UNSET_VALUE
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable(bucket, opts = {})
|
def enable(bucket, opts = {})
|
||||||
|
@ -34,8 +33,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
@scope = :box if @scope == UNSET_VALUE
|
@scope = :box if @scope == UNSET_VALUE
|
||||||
@auto_detect = false if @auto_detect == UNSET_VALUE
|
@auto_detect = false if @auto_detect == UNSET_VALUE
|
||||||
@enable_nfs = false if @enable_nfs == UNSET_VALUE
|
@synced_folder_opts = nil if @synced_folder_opts == UNSET_VALUE
|
||||||
@sync_opts = {} if @sync_opts == UNSET_VALUE
|
|
||||||
@buckets = @buckets ? @buckets.dup : {}
|
@buckets = @buckets ? @buckets.dup : {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,8 @@ module VagrantPlugins
|
||||||
FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist?
|
FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist?
|
||||||
|
|
||||||
synced_folder_opts = {id: "vagrant-cache"}
|
synced_folder_opts = {id: "vagrant-cache"}
|
||||||
synced_folder_opts.merge!(env[:machine].config.cache.sync_opts)
|
synced_folder_opts.merge!(env[:machine].config.cache.synced_folder_opts)
|
||||||
|
|
||||||
if env[:machine].config.cache.enable_nfs
|
|
||||||
# REFACTOR: Drop the `nfs: true` argument once we drop support for Vagrant < 1.4
|
|
||||||
synced_folder_opts.merge!({ nfs: true, type: 'nfs' })
|
|
||||||
end
|
|
||||||
env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', synced_folder_opts
|
env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', synced_folder_opts
|
||||||
|
|
||||||
env[:cache_dirs] = []
|
env[:cache_dirs] = []
|
||||||
|
|
Loading…
Reference in a new issue