Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #346 - cleanup cache enabling #357

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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