class Chef::CookbookCacheCleaner
Keep track of the filenames that we use in both eager cookbook downloading (during sync_cookbooks) and lazy (during the run itself, through FileVendor). After the run is over, clean up the cache.
Attributes
Public Class Methods
Public Instance Methods
Source
# File lib/chef/cookbook/synchronizer.rb, line 62 def cleanup_file_cache unless Chef::Config[:solo_legacy_mode] || skip_removal # Delete each file in the cache that we didn't encounter in the # manifest. cache.find(File.join(%w{cookbooks ** {*,.*}})).each do |cache_filename| unless @valid_cache_entries[cache_filename] Chef::Log.info("Removing #{cache_filename} from the cache; it is no longer needed by #{ChefUtils::Dist::Infra::CLIENT}.") cache.delete(cache_filename) end end else Chef::Log.info("Skipping removal of unused files from the cache") end end
Source
# File lib/chef/cookbook/synchronizer.rb, line 54 def mark_file_as_valid(cache_path) @valid_cache_entries[cache_path] = true end
Source
# File lib/chef/cookbook/synchronizer.rb, line 49 def reset! @skip_removal = nil @valid_cache_entries = {} end