diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-10-30 14:56:48 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-10-30 14:56:48 -0700 |
commit | 0f2a2f29e85679c608497e9e2d699ba7c36b2ad1 (patch) | |
tree | 5daa974c7c43342872456a3aeeca3d959db5ade5 /lib/chef/cookbook | |
parent | 51ed9dd1eaff95b68f10890892e64dbf99aba85b (diff) | |
download | chef-0f2a2f29e85679c608497e9e2d699ba7c36b2ad1.tar.gz |
More cookbook loader cleanup and documentation
Removes a bit more cruft left over from removing cookbook merging.
Tries to document what the loader actually is and what it does.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index c864c30505..66e3d536c5 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -7,6 +7,16 @@ require "find" class Chef class Cookbook + # This class is only used drectly from the Chef::CookbookLoader and from chef-fs, + # so it only affects legacy-mode chef-client runs and knife. It is not used by + # server or zolo/zero modes. + # + # This seems to be mostly a glorified factory method for creating CookbookVersion + # objects now, with creating Metadata objects bolted onto the side? It used + # to be also responsible for the merging of multiple objects when creating + # shadowed/merged cookbook versions from multiple sources. It also handles + # Chefignore files. + # class CookbookVersionLoader UPLOADED_COOKBOOK_VERSION_FILE = ".uploaded-cookbook-version.json".freeze @@ -162,18 +172,6 @@ class Chef cookbook_settings.values.all? { |files_hash| files_hash.empty? } && metadata_filenames.size == 0 end - def merge!(other_cookbook_loader) - other_cookbook_settings = other_cookbook_loader.cookbook_settings - cookbook_settings.each do |file_type, file_list| - file_list.merge!(other_cookbook_settings[file_type]) - end - metadata_filenames.concat(other_cookbook_loader.metadata_filenames) - @cookbook_paths += other_cookbook_loader.cookbook_paths - @frozen = true if other_cookbook_loader.frozen - @metadata = nil # reset metadata so it gets reloaded and all metadata files applied. - self - end - def chefignore @chefignore ||= Chefignore.new(File.basename(cookbook_path)) end |