Module: Chef::Provider::LWRPBase::InlineResources
- Defined in:
- lib/chef/provider/lwrp_base.rb
Overview
Chef::Provider::LWRPBase::InlineResources Implementation of inline resource convergence for LWRP providers. See 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.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#recipe_eval_with_update_check(&block) ⇒ Object
Executes the given block in a temporary run_context with its own resource collection.
Instance Method Details
#recipe_eval_with_update_check(&block) ⇒ Object
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.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# 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 |