summaryrefslogtreecommitdiff
path: root/lib/chef/dsl/recipe.rb
diff options
context:
space:
mode:
authorTyler Ball <tyleraball@gmail.com>2014-10-17 16:15:12 -0500
committerTyler Ball <tyleraball@gmail.com>2014-10-17 16:15:12 -0500
commit9b3e925188a41bbea954429ac81ffdf65e936eda (patch)
tree4080102aa81bd9f94da69fa4d1ae44472536dd99 /lib/chef/dsl/recipe.rb
parent901e8eff95c953b91f597e4d83932d5b8803d31a (diff)
parented7a6d2dead738a99ebcb1782d29ca89924093cc (diff)
downloadchef-9b3e925188a41bbea954429ac81ffdf65e936eda.tar.gz
Merge pull request #2216 from opscode/tball/bsd_package_name
Notify a resource by the `resource[name]` key it was written as
Diffstat (limited to 'lib/chef/dsl/recipe.rb')
-rw-r--r--lib/chef/dsl/recipe.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb
index 0f46736823..94b0d2d18b 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -82,21 +82,7 @@ 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)
+ run_context.resource_collection.insert(resource, resource_type:type, instance_name:name)
resource
end
@@ -120,7 +106,7 @@ class Chef
# This behavior is very counter-intuitive and should be removed.
# See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694
# Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052
- resource.load_prior_resource
+ resource.load_prior_resource(type, name)
resource.cookbook_name = cookbook_name
resource.recipe_name = recipe_name
# Determine whether this resource is being created in the context of an enclosing Provider