summaryrefslogtreecommitdiff
path: root/lib/chef/dsl
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-10-13 06:50:36 -0500
committertyler-ball <tyleraball@gmail.com>2014-10-16 10:33:02 -0500
commitb2f47460c7036f94e1bed1ca23f4d18409374af2 (patch)
tree503f49eef0e28f2ae10562175b2a4a8f4bee041d /lib/chef/dsl
parentd3150dcf413e96a5140e0e30ac94698e159632a9 (diff)
downloadchef-b2f47460c7036f94e1bed1ca23f4d18409374af2.tar.gz
first attempt at refactoring ResourceCollection into two objects
Diffstat (limited to 'lib/chef/dsl')
-rw-r--r--lib/chef/dsl/recipe.rb19
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb
index 476d9db666..8578f41d92 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -86,21 +86,8 @@ 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_set.insert_as(type, name, resource)
+ run_context.resource_list << resource
resource
end
@@ -124,7 +111,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