diff options
author | Thom May <thom@may.lt> | 2015-10-05 16:45:28 +0100 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-10-05 16:45:28 +0100 |
commit | 132c85844dfdaef1d5acfe2bb272f961147509d8 (patch) | |
tree | faf26df32767196006de490ba2a1a9b4c5b24aa2 /lib | |
parent | f42e439686db89a1e123ed5293b9e63ebb426bf1 (diff) | |
parent | 53380ccb30465f003ddc2fb3461007c135110577 (diff) | |
download | chef-132c85844dfdaef1d5acfe2bb272f961147509d8.tar.gz |
Merge pull request #4003 from chef/tm/duplicate_recipes
Ensure that our list of recipes is backwards compat
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/node.rb | 2 | ||||
-rw-r--r-- | lib/chef/run_list/versioned_recipe_list.rb | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb index 668ddbdc35..1e4a850277 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -440,7 +440,7 @@ class Chef self.tags # make sure they're defined - automatic_attrs[:recipes] = expansion.recipes.with_fully_qualified_names_and_version_constraints + automatic_attrs[:recipes] = expansion.recipes.with_duplicate_names automatic_attrs[:expanded_run_list] = expansion.recipes.with_fully_qualified_names_and_version_constraints automatic_attrs[:roles] = expansion.roles diff --git a/lib/chef/run_list/versioned_recipe_list.rb b/lib/chef/run_list/versioned_recipe_list.rb index 2824f08f31..803156aef9 100644 --- a/lib/chef/run_list/versioned_recipe_list.rb +++ b/lib/chef/run_list/versioned_recipe_list.rb @@ -82,6 +82,21 @@ class Chef qualified_recipe end end + + # Get an array of strings of both fully-qualified and unexpanded recipe names + # in response to chef/chef#3767 + # Chef-13 will revert to the behaviour of just including the fully-qualified name + # + # @return [Array] Array of strings with fully-qualified and unexpanded recipe names + def with_duplicate_names + self.map do |recipe_name| + if recipe_name.include?('::') + recipe_name + else + [recipe_name, "#{recipe_name}::default"] + end + end.flatten + end end end end |