summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_version.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-04-04 22:02:51 -0700
committerNoah Kantrowitz <noah@coderanger.net>2017-04-04 22:02:51 -0700
commitf51d16101dd244046bece8721861c1aad332bca0 (patch)
tree62884b53d97c31f2aa0323ab7ad05e4e36297001 /lib/chef/cookbook_version.rb
parent1148f3319ca93e99e209443fc2823d09a6fb695c (diff)
downloadchef-f51d16101dd244046bece8721861c1aad332bca0.tar.gz
First pass on implementing root aliases.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/cookbook_version.rb')
-rw-r--r--lib/chef/cookbook_version.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 738f98929e..a3c38e4e26 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -134,11 +134,21 @@ class Chef
end
def attribute_filenames_by_short_filename
- @attribute_filenames_by_short_filename ||= filenames_by_name(files_for("attributes"))
+ @attribute_filenames_by_short_filename ||= begin
+ name_map = filenames_by_name(files_for("attributes"))
+ root_alias = cookbook_manifest.root_files.find {|record| record[:name] == "attributes.rb" }
+ name_map["default"] = root_alias[:full_path] if root_alias
+ name_map
+ end
end
def recipe_filenames_by_name
- @recipe_filenames_by_name ||= filenames_by_name(files_for("recipes"))
+ @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
+ name_map
+ end
end
def metadata=(metadata)