module ChefCompat::CopiedFromChef::Chef::Mixin::NotifyingBlock
Public Instance Methods
notifying_block(&block)
click to toggle source
# File files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb, line 32 def notifying_block(&block) begin subcontext = subcontext_block(&block) Chef::Runner.new(subcontext).converge ensure # recipes don't have a new_resource if respond_to?(:new_resource) if subcontext && subcontext.resource_collection.any?(&:updated?) new_resource.updated_by_last_action(true) end end end end
subcontext_block(parent_context = nil, &block)
click to toggle source
# File files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb, line 46 def subcontext_block(parent_context = nil, &block) parent_context ||= @run_context sub_run_context = parent_context.create_child begin outer_run_context = @run_context @run_context = sub_run_context instance_eval(&block) ensure @run_context = outer_run_context end sub_run_context end