diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-08-13 11:56:59 -0700 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-08-13 11:57:08 -0700 |
commit | 8d3dfdc77591b8f35ca92a94046ff629ac1f23fb (patch) | |
tree | a1b48fe35f66bd99d033e325e168af834b29a535 /lib/chef/dsl | |
parent | 6ad12bac9cd0b736915dcafe9232d168bc1e0dc6 (diff) | |
download | chef-8d3dfdc77591b8f35ca92a94046ff629ac1f23fb.tar.gz |
Make sure freebsd_package is captured with the resource name it's declared with in resource collection.
Diffstat (limited to 'lib/chef/dsl')
-rw-r--r-- | lib/chef/dsl/recipe.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb index 23cfbd558c..3282320b8c 100644 --- a/lib/chef/dsl/recipe.rb +++ b/lib/chef/dsl/recipe.rb @@ -85,6 +85,20 @@ class Chef resource = build_resource(type, name, created_at, &resource_attrs_block) + # Some resources (freebsd_package) can be invoked with multiple names + # (package || freebsd_package). + # https://github.com/opscode/chef/issues/1773 + # For these resources we want to make sure + # their key in resource collection is same as the name they are declared + # as. Since this might be a breaking change for resources that define + # customer to_s methods, we are working around the issue by letting + # resources know of their created_as_type until this issue is fixed in + # Chef 12: + # https://github.com/opscode/chef/issues/1817 + if resource.respond_to?(:created_as_type=) + resource.created_as_type = type + end + run_context.resource_collection.insert(resource) resource end |