module Chef::Provider::LWRPBase::InlineResources
Chef::Provider::LWRPBase::InlineResources Implementation of inline resource convergence for LWRP providers. See Chef::Provider::LWRPBase.use_inline_resources for a longer explanation.
This code is restricted to a module so that it can be selectively applied to providers on an opt-in basis.
Public Instance Methods
recipe_eval_with_update_check(&block)
click to toggle source
Executes the given block in a temporary run_context with its own resource collection. After the block is executed, any resources declared inside are converged, and if any are updated, the new_resource will be marked updated.
# File lib/chef/provider/lwrp_base.rb, line 54 def recipe_eval_with_update_check(&block) saved_run_context = @run_context temp_run_context = @run_context.dup @run_context = temp_run_context @run_context.resource_collection = Chef::ResourceCollection.new return_value = instance_eval(&block) Chef::Runner.new(@run_context).converge return_value ensure @run_context = saved_run_context if temp_run_context.resource_collection.any? {|r| r.updated? } new_resource.updated_by_last_action(true) end end