summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-08-21 15:56:03 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-08-22 12:58:20 -0700
commitc3c96af29903d0456625c6cce642d26c68e58b1d (patch)
treedacef9730e18eae1a9f306a7c4301df1b20ea01a
parentd9f4d99ea811195d20ddb2997b321de343d01c57 (diff)
downloadchef-c3c96af29903d0456625c6cce642d26c68e58b1d.tar.gz
lazy the default resource_name until after parsing
only set it if the resource doesn't set one. this means that we don't call resource_name or provides before parsing the file so that the chef_version_for_provides API in #7524 can work (otherwise we throw the deprecation warning before we ever parse the file). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/resource/lwrp_base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb
index c0f6f835ad..6c8132fa03 100644
--- a/lib/chef/resource/lwrp_base.rb
+++ b/lib/chef/resource/lwrp_base.rb
@@ -49,9 +49,7 @@ class Chef
resource_name = filename_to_qualified_string(cookbook_name, filename)
- # We load the class first to give it a chance to set its own name
resource_class = Class.new(self)
- resource_class.resource_name resource_name.to_sym
resource_class.run_context = run_context
resource_class.class_from_file(filename)
@@ -67,6 +65,8 @@ class Chef
LWRPBase.loaded_lwrps[filename] = true
+ resource_class.resource_name resource_name.to_sym if resource_class.resource_name.nil?
+
resource_class
end