From e46a3c398b314771b061aeb7105258be841e4878 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Tue, 6 Aug 2013 17:31:55 -0300 Subject: [PATCH] Prevent errors when caching is disabled --- lib/vagrant-cachier/action/ensure_single_cache_root.rb | 3 ++- lib/vagrant-cachier/provision_ext.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-cachier/action/ensure_single_cache_root.rb b/lib/vagrant-cachier/action/ensure_single_cache_root.rb index ae46b1e..def6375 100644 --- a/lib/vagrant-cachier/action/ensure_single_cache_root.rb +++ b/lib/vagrant-cachier/action/ensure_single_cache_root.rb @@ -21,7 +21,8 @@ module VagrantPlugins end def cache_scoped_to_machine? - @env[:machine].config.cache.scope.to_sym == :machine + @env[:machine].config.cache.enabled? && + @env[:machine].config.cache.scope.to_sym == :machine end def ensure_single_cache_root_exists! diff --git a/lib/vagrant-cachier/provision_ext.rb b/lib/vagrant-cachier/provision_ext.rb index 21e094e..cd17436 100644 --- a/lib/vagrant-cachier/provision_ext.rb +++ b/lib/vagrant-cachier/provision_ext.rb @@ -34,6 +34,8 @@ module VagrantPlugins end def configure_cache_buckets + return unless @env[:machine].config.cache.enabled? + if @env[:machine].config.cache.auto_detect Bucket.auto_detect(@env) end