summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-14 19:21:44 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-14 19:21:44 -0700
commit14d8a56a18a41c89a78d249b13979c848bf08044 (patch)
tree2d11f90b15fda81b3f6a7d4950f77827ba399e2e
parentd67c911268263c710b79cb1bcf8c720d270deb8b (diff)
downloadchef-14d8a56a18a41c89a78d249b13979c848bf08044.tar.gz
Improve the warning message shown for node map collisions.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--lib/chef/node_map.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb
index 3fa1f1b924..0a79563929 100644
--- a/lib/chef/node_map.rb
+++ b/lib/chef/node_map.rb
@@ -37,6 +37,21 @@
#
class Chef
class NodeMap
+ COLLISION_WARNING_14 = <<-EOH.gsub(/\s+/, ' ').strip
+%{type_caps} %{key} has been loaded from a cookbook. The %{type} %{key} is now
+included in Chef and will take precedence over the existing cookbook %{type} in the
+next major release of Chef (15.0, April 2019). You may be able to remove this cookbook dependency from
+your runlist if you do not use other recipes/resources/libraries from the cookbook.
+Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
+EOH
+
+ COLLISION_WARNING_15 = <<-EOH.gsub(/\s+/, ' ').strip
+%{type_caps} %{key} attempted to load from a cookbook. The %{type} %{key} is now
+included in Chef and takes precedence over the existing cookbook %{type}
+which will be ignored. You may be able to remove this cookbook dependency from
+your runlist if you do not use other recipes/resources/libraries from the cookbook.
+Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
+EOH
#
# Set a key/value pair on the map with a filter. The filter must be true
@@ -85,9 +100,9 @@ class Chef
klass.superclass.to_s
end
# For now, only log the warning.
- Chef.deprecated(:map_collision, "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.")
+ Chef.deprecated(:map_collision, COLLISION_WARNING_14 % {type: type_of_thing, key: key, type_caps: type_of_thing.capitalize})
# In 15.0, uncomment this and remove the log above.
- # Chef.ldeprecated(:map_collision, "Rejecting attempt 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.")
+ # Chef.deprecated(:map_collision, COLLISION_WARNING_15 % {type: type_of_thing, key: key, type_caps: type_of_thing.capitalize}))
# return
end