summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-06-30 14:55:05 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2020-06-30 14:55:50 -0700
commit6bd16a6933cd6a1dc7e881e651b00786dc5b9510 (patch)
tree32ede3aa9aea76bea4eb86b5194dc4a466798656
parent8ef6b65b7badc6cd66e7dbefc24a91522da916e5 (diff)
downloadchef-6bd16a6933cd6a1dc7e881e651b00786dc5b9510.tar.gz
Add resource_name_without_provides deprecationlcg/resource_name_without_provides
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/deprecated.rb4
-rw-r--r--lib/chef/resource/lwrp_base.rb6
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/chef/deprecated.rb b/lib/chef/deprecated.rb
index d67cee8153..4a2ac69b04 100644
--- a/lib/chef/deprecated.rb
+++ b/lib/chef/deprecated.rb
@@ -241,6 +241,10 @@ class Chef
target 30
end
+ class ResourceNameWithoutProvides < Base
+ target 31
+ end
+
class Generic < Base
def url
"https://docs.chef.io/chef_deprecations_client/"
diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb
index cd8086d0ce..3c0da3f422 100644
--- a/lib/chef/resource/lwrp_base.rb
+++ b/lib/chef/resource/lwrp_base.rb
@@ -65,6 +65,12 @@ class Chef
LWRPBase.loaded_lwrps[filename] = true
+ unless resource_class.resource_name.nil?
+ if Chef.resource_handler_map.get(node, resource_class.resource_name, canonical: true) == resource_class
+ Chef.deprecated(:resource_name_without_provides, "Resource #{resource_class.resource_name} needs `provides :#{resource_class.resource_name}` in addition to `resource_name :#{resource_class.resource_name}` declaration")
+ end
+ end
+
# wire up the default resource name after the class is parsed only if we haven't declared one.
# (this ordering is important for MapCollision deprecation warnings)
resource_class.resource_name resource_name.to_sym if resource_class.resource_name.nil?