Module: Chef::Provider::InlineResources Private

Defined in:
lib/chef/provider.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Chef::Provider::InlineResources Implementation of inline resource convergence for providers. See Provider.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

Instance Method Details

#compile_and_converge_action(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a child run_context, compile the block, and converge it.



358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/chef/provider.rb', line 358

def compile_and_converge_action(&block)
  old_run_context = run_context
  @run_context = run_context.create_child
  return_value = instance_eval(&block)
  Chef::Runner.new(run_context).converge
  return_value
ensure
  if run_context.resource_collection.any? { |r| r.updated? }
    new_resource.updated_by_last_action(true)
  end
  @run_context = old_run_context
end