summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-05-04 17:40:50 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-05 20:25:11 -0700
commitc88877cecb0a24a7a85c6cb2015ffd2b39c10ecd (patch)
tree275f81e521f60052dc164f9f8c192dc8c7363dbe
parent435ccd59e3d21c0fa247cbae9eaaff20901580e3 (diff)
downloadchef-c88877cecb0a24a7a85c6cb2015ffd2b39c10ecd.tar.gz
Fix up the thing namer.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--lib/chef/node_map.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb
index b6ef008ce1..f928888b79 100644
--- a/lib/chef/node_map.rb
+++ b/lib/chef/node_map.rb
@@ -76,7 +76,14 @@ class Chef
# 4. No previous `provides` had `allow_cookbook_override`, either set to
# true or with a string version matcher that still matches Chef::VERSION
if !__core_override__ && map[key] && map[key].any? {|matcher| matcher[:locked] } && !map[key].any? {|matcher| matcher[:cookbook_override].is_a?(String) ? Chef::VERSION =~ matcher[:cookbook_override] : matcher[:cookbook_override] }
- type_of_thing = klass.is_a?(Chef::Resource) ? 'resource' : 'provider'
+ # If we ever use locked mode on things other than the resource and provider handler maps, this probably needs a tweak.
+ type_of_thing = if klass < Chef::Resource
+ 'resource'
+ elsif klass < Chef::Provider
+ 'provider'
+ else
+ klass.superclass.to_s
+ end
# For now, only log the warning.
Chef.log_deprecation("Trying to register #{type_of_thing} #{key} on top of existing Chef core #{type_of_thing}. Check if a new version of the cookbook is available.")
# In 15.0, uncomment this and remove the log above.