diff options
-rw-r--r-- | chef-config/lib/chef-config/config.rb | 5 | ||||
-rw-r--r-- | lib/chef/mixin/notifying_block.rb | 3 | ||||
-rw-r--r-- | lib/chef/provider.rb | 11 | ||||
-rw-r--r-- | lib/chef/resource_builder.rb | 4 | ||||
-rw-r--r-- | lib/chef/run_context.rb | 8 |
5 files changed, 6 insertions, 25 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index d66be1a749..23e4d75168 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -1053,7 +1053,10 @@ module ChefConfig default :rubygems_url, "https://rubygems.org" - # For Chef-12 this is still the default, in Chef-13 the default will be false + # This controls the behavior of resource cloning (and CHEF-3694 warnings). For Chef < 12 the behavior + # has been that this is 'true', in Chef 13 this will change to false. Setting this to 'true' in Chef + # 13 is not a viable or supported migration strategy since Chef 13 community cookbooks will be expected + # to break with this setting set to 'true'. default :resource_cloning, true # If installed via an omnibus installer, this gives the path to the diff --git a/lib/chef/mixin/notifying_block.rb b/lib/chef/mixin/notifying_block.rb index 3ebb79ee7e..2d6a82f493 100644 --- a/lib/chef/mixin/notifying_block.rb +++ b/lib/chef/mixin/notifying_block.rb @@ -37,9 +37,6 @@ class Chef parent_context ||= @run_context sub_run_context = parent_context.create_child - # inhert the resource_cloning setting from our parent context - sub_run_context.resource_cloning = parent_context.resource_cloning - begin outer_run_context = @run_context @run_context = sub_run_context diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index c2031712ec..40c31e4371 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -342,15 +342,6 @@ class Chef include InlineResources end - # allow users to control enabling/disabling resource cloning per-resource - class << self - attr_accessor :resource_cloning - - def resource_cloning(val) - @resource_cloning = val - end - end - # Chef::Provider::InlineResources # Implementation of inline resource convergence for providers. See # Provider.use_inline_resources for a longer explanation. @@ -367,8 +358,6 @@ class Chef def compile_and_converge_action(&block) old_run_context = run_context @run_context = run_context.create_child - # use_inline_resources gets the setting from the class instance variable - @run_context.resource_cloning = self.class.resource_cloning return_value = instance_eval(&block) Chef::Runner.new(run_context).converge return_value diff --git a/lib/chef/resource_builder.rb b/lib/chef/resource_builder.rb index 607e78358a..1aee852f5d 100644 --- a/lib/chef/resource_builder.rb +++ b/lib/chef/resource_builder.rb @@ -56,7 +56,7 @@ class Chef # This behavior is very counter-intuitive and should be removed. # See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694 # Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052 - if prior_resource && run_context.resource_cloning + if prior_resource && Chef::Config[:resource_cloning] resource.load_from(prior_resource) end @@ -80,7 +80,7 @@ class Chef end # emit a cloned resource warning if it is warranted - if prior_resource && run_context.resource_cloning + if prior_resource && Chef::Config[:resource_cloning] if is_trivial_resource?(prior_resource) && identicalish_resources?(prior_resource, resource) emit_harmless_cloning_debug else diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index 511b64ed02..aa6280e5be 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -110,11 +110,6 @@ class Chef # attr_reader :audits - # Toggle to enable/disable resource cloning - # - # @return [Boolean] True if resource cloning is enabled for this run_context - attr_accessor :resource_cloning - # # Notification handling # @@ -197,7 +192,6 @@ class Chef # def initialize_child_state @audits = {} - @resource_cloning = Chef::Config[:resource_cloning] @resource_collection = Chef::ResourceCollection.new(self) @before_notification_collection = Hash.new { |h, k| h[k] = [] } @immediate_notification_collection = Hash.new { |h, k| h[k] = [] } @@ -657,8 +651,6 @@ ERROR_MESSAGE delayed_notification_collection delayed_notification_collection= delayed_notifications - resource_cloning - resource_cloning= immediate_notification_collection immediate_notification_collection= immediate_notifications |