From d16b4d98a8eac0ee94718e2c7b563a5ddbc4d988 Mon Sep 17 00:00:00 2001 From: Seth Thomas Date: Tue, 24 Apr 2018 09:19:53 -0400 Subject: [PATCH] Fix #346 - cleanup cache enabling Signed-off-by: Seth Thomas --- lib/kitchen/driver/vagrant.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/kitchen/driver/vagrant.rb b/lib/kitchen/driver/vagrant.rb index 9b5bde4c..31c03e90 100644 --- a/lib/kitchen/driver/vagrant.rb +++ b/lib/kitchen/driver/vagrant.rb @@ -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") @@ -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 @@ -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