Skip to content

Commit

Permalink
Fix #346 - cleanup cache enabling
Browse files Browse the repository at this point in the history
Signed-off-by: Seth Thomas <[email protected]>
  • Loading branch information
Seth Thomas committed Apr 24, 2018
1 parent fad28aa commit d16b4d9
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ class Vagrant < Kitchen::Driver::Base
driver.windows_os? ? nil : "#{driver.instance.name}.vagrantup.com"
end

default_config(:cache_directory) do |driver|
driver.windows_os? ? "/omnibus/cache" : "/tmp/omnibus/cache"
end
default_config :cache_directory, false

default_config :kitchen_cache_directory,
File.expand_path("~/.kitchen/cache")
Expand Down Expand Up @@ -202,8 +200,10 @@ def winrm_transport?
# and share a local folder to that directory so that we don't pull them
# down every single time
def cache_directory
if enable_cache?
if config[:cache_directory]
config[:cache_directory]
elsif safe_share?(config[:box])
"/tmp/omnibus/cache"
else
false
end
Expand Down Expand Up @@ -247,15 +247,6 @@ def safe_share?(box)
box =~ /^bento\/(centos|debian|fedora|opensuse|ubuntu|oracle)-/
end

# Return true if we found the criteria to enable the cache_directory
# functionality
def enable_cache?
return false unless config[:cache_directory]
return true if safe_share?(config[:box])
# Otherwise
false
end

# Renders and writes out a Vagrantfile dedicated to this instance.
#
# @api private
Expand Down

0 comments on commit d16b4d9

Please sign in to comment.