Use vagrant tmp directory for boxes [GH-1442]

This commit is contained in:
Mitchell Hashimoto 2013-04-07 14:48:49 -07:00
parent 998122e076
commit efaabea5c0
3 changed files with 9 additions and 4 deletions

View File

@ -60,6 +60,8 @@ BUG FIXES:
reporting dynamic progress.
- When using `Builder` instances for hooks, the builders will be
merged for the proper before/after chain. [GH-1555]
- Use the Vagrant temporary directory again for temporary files
since they can be quite large and were messing with tmpfs. [GH-1442]
## 1.1.6 (April 3, 2013)

View File

@ -39,8 +39,11 @@ module Vagrant
#
# @param [Pathname] directory The directory that contains the collection
# of boxes.
def initialize(directory)
def initialize(directory, options=nil)
options ||= {}
@directory = directory
@temp_root = options[:temp_dir_root]
@logger = Log4r::Logger.new("vagrant::box_collection")
end
@ -299,7 +302,7 @@ module Vagrant
def v1_upgrade(dir)
@logger.debug("Upgrading box in directory: #{dir}")
temp_dir = Pathname.new(Dir.mktmpdir("vagrant-"))
temp_dir = Pathname.new(Dir.mktmpdir(TEMP_PREFIX, @temp_root))
@logger.debug("Temporary directory for upgrading: #{temp_dir}")
# Move all the things into the temporary directory
@ -333,7 +336,7 @@ module Vagrant
# @param [String] dir Path to a temporary directory
# @return [Object] The result of whatever the yield is
def with_temp_dir(dir=nil)
dir ||= Dir.mktmpdir("vagrant-")
dir ||= Dir.mktmpdir(TEMP_PREFIX, @temp_root)
dir = Pathname.new(dir)
yield dir

View File

@ -223,7 +223,7 @@ module Vagrant
#
# @return [BoxCollection]
def boxes
@_boxes ||= BoxCollection.new(boxes_path)
@_boxes ||= BoxCollection.new(boxes_path, temp_dir_root: tmp_path)
end
# This is the global config, comprised of loading configuration from