lib/sous_vide/event_methods.rb
# Called before action is executed on a resource.
Called before action is executed on a resource.
Called before action is executed on a resource .
def resource_action_start(new_resource, action, notification_type, notifying_resource)
      if nested?(new_resource) 
        new_r_name = "#{new_resource.resource_name}[#{new_resource.name}]##{action}"
        debug("Received :resource_action_start on #{new_r_name}.",
              "It's a nested resource and will be ignored.")
        return false
      end
      if notification_type == :delayed && @run_phase != "delayed"
        debug("Changed run phase to 'delayed'.")
        @run_phase = "delayed"
      end
      @processing_now = create(chef_resource: new_resource, action: action)
      debug("Received :resource_action_start on #{@processing_now}.")
      @execution_order += 1
      @processing_now.execution_order = @execution_order
      @processing_now.execution_phase = @run_phase
      @processing_now.started_at = Time.now.strftime("%F %T")
      @processing_now.chef_resource_handle = new_resource
      @processing_now.before_notifications = new_resource.before_notifications.size
      @processing_now.immediate_notifications = new_resource.immediate_notifications.size
      @processing_now.delayed_notifications = new_resource.delayed_notifications.size
      if notifying_resource
        _name = "#{notifying_resource.resource_name}[#{notifying_resource.name}]"
        debug("Notified from #{_name} (:#{notification_type})")
        @processing_now.notifying_resource = _name
      end
      @processing_now.notification_type = notification_type
      true
    end
def resource_action_start ( new_resource , action , notification_type , notifying_resource ) if nested? ( new_resource ) new_r_name = "#{new_resource.resource_name}[#{new_resource.name}]##{action}" debug ( "Received :resource_action_start on #{new_r_name}." , "It's a nested resource and will be ignored." ) return false end if notification_type == :delayed && @run_phase != "delayed" debug ( "Changed run phase to 'delayed'." ) @run_phase = "delayed" end @processing_now = create ( chef_resource : new_resource , action : action ) debug ( "Received :resource_action_start on #{@processing_now}." ) @execution_order += 1 @processing_now . execution_order = @execution_order @processing_now . execution_phase = @run_phase @processing_now . started_at = Time . now . strftime ( "%F %T" ) @processing_now . chef_resource_handle = new_resource @processing_now . before_notifications = new_resource . before_notifications . size @processing_now . immediate_notifications = new_resource . immediate_notifications . size @processing_now . delayed_notifications = new_resource . delayed_notifications . size if notifying_resource _name = "#{notifying_resource.resource_name}[#{notifying_resource.name}]" debug ( "Notified from #{_name} (:#{notification_type})" ) @processing_now . notifying_resource = _name end @processing_now . notification_type = notification_type true end
Called before action is executed on a resource.
Called before action is executed on a resource .
# ignore nested resources # This is a delayed notification. From now on we are in 'delayed' run phase. # When notifying resource is present notification_type will also be present.  It is nil for # delayed notifications.
new_resource
<not_specific>
action
<not_specific>
notification_type
<not_specific>
notifying_resource
<not_specific>