summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_version.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-04-04 22:24:29 -0700
committerNoah Kantrowitz <noah@coderanger.net>2017-04-04 22:24:29 -0700
commit2fa4ec2392ba002c6881a2283ca65320471e4c7b (patch)
treeec78d5ee53ecda07d8732e26704fa5b3da30e177 /lib/chef/cookbook_version.rb
parentf51d16101dd244046bece8721861c1aad332bca0 (diff)
downloadchef-2fa4ec2392ba002c6881a2283ca65320471e4c7b.tar.gz
Make root alias attributes work with the normal CookbookCompiler load behavior.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/cookbook_version.rb')
-rw-r--r--lib/chef/cookbook_version.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index a3c38e4e26..602388d0b7 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -146,7 +146,10 @@ class Chef
@recipe_filenames_by_name ||= begin
name_map = filenames_by_name(files_for("recipes"))
root_alias = cookbook_manifest.root_files.find {|record| record[:name] == "recipe.rb" }
- name_map["default"] = root_alias[:full_path] if root_alias
+ if root_alias
+ Chef::Log.error("Cookbook #{name} contains both recipe.rb and and recipes/default.rb, ignoring recipes/default.rb") if name_map["default"]
+ name_map["default"] = root_alias[:full_path]
+ end
name_map
end
end