diff options
author | Tim Smith <tsmith@chef.io> | 2019-05-07 15:27:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-07 15:27:18 -0700 |
commit | c0139ec8c6ba585b2f140a87d421131d15da4165 (patch) | |
tree | af438ed29199bd250e7140363d756c0c1cf2c6c5 /lib/chef | |
parent | 6fc8b5f7f36b754aab979a56ece68500ab2ad87e (diff) | |
parent | 52a2c0e7092929e46c6765e8797775bc0a38bd9a (diff) | |
download | chef-c0139ec8c6ba585b2f140a87d421131d15da4165.tar.gz |
Merge pull request #8470 from chef/lcg/remove-collision-deprecation
Remove resource collision deprecations
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/deprecated.rb | 4 | ||||
-rw-r--r-- | lib/chef/node_map.rb | 29 | ||||
-rw-r--r-- | lib/chef/resource.rb | 13 |
3 files changed, 9 insertions, 37 deletions
diff --git a/lib/chef/deprecated.rb b/lib/chef/deprecated.rb index 6516366d49..e3931427ba 100644 --- a/lib/chef/deprecated.rb +++ b/lib/chef/deprecated.rb @@ -207,9 +207,7 @@ class Chef target 23 end - class MapCollision < Base - target 25 - end + # id 25 was deleted # id 3694 was deleted diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index e66e249a97..01f9d215cb 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -1,6 +1,6 @@ # # Author:: Lamont Granquist (<lamont@chef.io>) -# Copyright:: Copyright 2014-2018, Chef Software Inc. +# Copyright:: Copyright 2014-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,12 +37,7 @@ # class Chef class NodeMap - COLLISION_WARNING_14 = <<~EOH.gsub(/\s+/, " ").strip - %{type_caps} %{key} from a cookbook is overriding the %{type} from the client. Please upgrade your cookbook - or remove the cookbook from your run_list before the next major release of Chef. - EOH - - COLLISION_WARNING_15 = <<~EOH.gsub(/\s+/, " ").strip + COLLISION_WARNING = <<~EOH.gsub(/\s+/, " ").strip %{type_caps} %{key} from the client is overriding the %{type} from a cookbook. Please upgrade your cookbook or remove the cookbook from your run_list. EOH @@ -54,19 +49,13 @@ class Chef # @param key [Object] Key to store # @param value [Object] Value associated with the key # @param filters [Hash] Node filter options to apply to key retrieval - # @param allow_cookbook_override [Boolean, String] Allow a cookbook to add - # to this key even in locked mode. If a string is given, it should be a - # Gem::Requirement-compatible value indicating for which Chef versions an - # override from cookbooks is allowed. - # @param __core_override__ [Boolean] Advanced-mode override to add to a key - # even in locked mode. # @param chef_version [String] version constraint to match against the running Chef::VERSION # # @yield [node] Arbitrary node filter as a block which takes a node argument # # @return [NodeMap] Returns self for possible chaining # - def set(key, klass, platform: nil, platform_version: nil, platform_family: nil, os: nil, canonical: nil, override: nil, allow_cookbook_override: false, __core_override__: false, chef_version: nil, target_mode: nil, &block) # rubocop:disable Lint/UnderscorePrefixedVariableName + def set(key, klass, platform: nil, platform_version: nil, platform_family: nil, os: nil, canonical: nil, override: nil, chef_version: nil, target_mode: nil, &block) new_matcher = { klass: klass } new_matcher[:platform] = platform if platform new_matcher[:platform_version] = platform_version if platform_version @@ -75,8 +64,6 @@ class Chef new_matcher[:block] = block if block new_matcher[:canonical] = canonical if canonical new_matcher[:override] = override if override - new_matcher[:cookbook_override] = allow_cookbook_override - new_matcher[:core_override] = __core_override__ new_matcher[:target_mode] = target_mode if chef_version && Chef::VERSION !~ chef_version @@ -88,9 +75,7 @@ class Chef # 1. Core override mode is not set. # 2. The key exists. # 3. At least one previous `provides` is now locked. - # 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] } + if 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] } # 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" @@ -99,11 +84,7 @@ class Chef else klass.superclass.to_s end - # For now, only log the warning. - 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.deprecated(:map_collision, COLLISION_WARNING_15 % {type: type_of_thing, key: key, type_caps: type_of_thing.capitalize})) - # return + Chef::Log.warn( COLLISION_WARNING % { type: type_of_thing, key: key, type_caps: type_of_thing.capitalize } ) end # The map is sorted in order of preference already; we just need to find diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index e08b2b0bc3..fb21ae1064 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -1172,10 +1172,9 @@ class Chef # Set or return if this resource is in preview mode. # - # This is used in Chef core as part of the process of migrating resources - # from a cookbook into core. It should be set to `true` when a cookbook - # resource is added to core, and then removed (set to `false`) in the next - # major release. + # This only has value in the resource_inspector to mark a resource as being new-to-chef-core. + # Its meaning is probably more equivalent to "experimental" in that the API might change even + # in minor versions due to bugfixing and is NOT considered "stable" yet. # # @param value [nil, Boolean] If nil, get the current value. If not nil, set # the value of the flag. @@ -1354,12 +1353,6 @@ class Chef remove_canonical_dsl end - # If a resource is in preview mode, set allow_cookbook_override on all its - # mappings by default. - if preview_resource && !options.include?(:allow_cookbook_override) - options[:allow_cookbook_override] = true - end - if @chef_version_for_provides && !options.include?(:chef_version) options[:chef_version] = @chef_version_for_provides end |