Restore original lines in setup_buckets_folder. Add final logic for determining base_path to use for caching
This commit is contained in:
parent
67217fff02
commit
fa581a325e
1 changed files with 17 additions and 5 deletions
|
@ -21,14 +21,13 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_buckets_folder
|
def setup_buckets_folder
|
||||||
|
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.synced_folder_opts || {})
|
synced_folder_opts.merge!(@env[:machine].config.cache.synced_folder_opts || {})
|
||||||
puts([@env[:machine].config.cache.override_directory, cache_root].join(''))
|
|
||||||
|
|
||||||
FileUtils.mkdir_p([@env[:machine].config.cache.override_directory, cache_root].join('').to_s) unless File.directory?([@env[:machine].config.cache.override_directory, cache_root].join('').to_s)
|
|
||||||
|
|
||||||
@env[:machine].config.vm.synced_folder [@env[:machine].config.cache.override_directory, cache_root].join(''), '/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] = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,9 +47,22 @@ module VagrantPlugins
|
||||||
else
|
else
|
||||||
bucket_name = @box_name
|
bucket_name = @box_name
|
||||||
end
|
end
|
||||||
@env[:home_path].join('cache', bucket_name)
|
# An override directory has been specified. Use this as the base instead of the standard directory
|
||||||
|
if !@env[:machine].config.cache.override_directory.nil?
|
||||||
|
base_path = Pathname.new(@env[:machine].config.cache.override_directory)
|
||||||
|
else
|
||||||
|
base_path = @env[:home_path]
|
||||||
|
end
|
||||||
|
base_path.join('cache', bucket_name)
|
||||||
when :machine
|
when :machine
|
||||||
@env[:machine].data_dir.parent.join('cache')
|
# An override directory has been specified. Use this as the base instead of the standard directory
|
||||||
|
if !@env[:machine].config.cache.override_directory.nil?
|
||||||
|
base_path = Pathname.new(@env[:machine].config.cache.override_directory)
|
||||||
|
base_path += @env[:machine].name.to_s
|
||||||
|
else
|
||||||
|
base_path = @env[:machine].data_dir.parent
|
||||||
|
end
|
||||||
|
base_path.join('cache')
|
||||||
else
|
else
|
||||||
raise "Unknown cache scope: '#{@env[:machine].config.cache.scope}'"
|
raise "Unknown cache scope: '#{@env[:machine].config.cache.scope}'"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue