First shot at adding a config option to override the directory used on the host machine

This commit is contained in:
Avi Oza 2017-04-30 22:22:05 -04:00
parent a0cdcb05a2
commit f74a13ce22
2 changed files with 4 additions and 3 deletions

View file

@ -21,12 +21,13 @@ module VagrantPlugins
end
def setup_buckets_folder
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.merge!(@env[:machine].config.cache.synced_folder_opts || {})
puts(@env[:machine].config.cache.override_directory)
@env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', synced_folder_opts
@env[:machine].config.vm.synced_folder @env[:machine].config.cache.override_directory || cache_root, '/tmp/vagrant-cache', synced_folder_opts
@env[:cache_dirs] = []
end

View file

@ -1,7 +1,7 @@
module VagrantPlugins
module Cachier
class Config < Vagrant.plugin(2, :config)
attr_accessor :scope, :auto_detect, :synced_folder_opts
attr_accessor :scope, :auto_detect, :synced_folder_opts, :override_directory
attr_reader :buckets
ALLOWED_SCOPES = %w( box machine )