diff options
author | danielsdeleo <dan@getchef.com> | 2014-08-11 09:52:45 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2014-08-12 11:03:10 -0700 |
commit | 02614080b7f068c2350200147d0e834ed540854a (patch) | |
tree | 06f83c0d48c849af2113cac22ce34427f17e89be | |
parent | 3cae751aa5174735b9e0b38b885752125e10ec6b (diff) | |
download | chef-02614080b7f068c2350200147d0e834ed540854a.tar.gz |
Document why we need to fallback to inferred name sometimes
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index 6c85cdef54..bf52781916 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -36,7 +36,6 @@ class Chef # We keep a list of all cookbook paths that have been merged in @cookbook_paths = [ cookbook_path ] - # TODO: Add a "strict mode" setting, use this when not in strict mode @inferred_cookbook_name = File.basename( path ) @chefignore = chefignore @metadata = nil @@ -138,6 +137,14 @@ class Chef end def cookbook_name + # The `name` attribute is now required in metadata, so + # inferred_cookbook_name generally should not be used. Per CHEF-2923, + # we have to not raise errors in cookbook metadata immediately, so that + # users can still `knife cookbook upload some-cookbook` when an + # unrelated cookbook has an error in its metadata. This situation + # could prevent us from reading the `name` attribute from the metadata + # entirely, but the name is used as a hash key in CookbookLoader, so we + # fall back to the inferred name here. (metadata.name || @inferred_cookbook_name).to_sym end |