class SousVide::TrackedResource
It is a very simple data structure SousVide
uses to capture information about resource execution.
Attributes
Action executed on this resource.
Number of before notifications attached to this resource.
Chef API resource. It is used for comparsion only. @api private
Number of delayed notifications attached to this resource.
Last error output if available. This can be populated when resource failed and when resource succeed after a retry.
Resource definition that triggered the error.
Resource execution order. Takes into account notifications and does not reflect resource. order on the run list.
SousVide
run-phase when this resource was executed.
Number of immediate notifications attached to this resource.
Resource that triggered this execution. Delayed notifications do not have this.
Number of retries.
Result of the action, ie. “updated”, “skipped”, …
Public Class Methods
# File lib/sous_vide/tracked_resource.rb, line 67 def initialize(name:, action:, type:) @name = name @action = action @type = type @status = "unprocessed" @duration_ms = nil @guard_description = nil @retries = 0 @error_output = nil @error_source = nil end
Public Instance Methods
Serializes the resource to hash @return [Hash]
# File lib/sous_vide/tracked_resource.rb, line 89 def to_h { chef_resource: "#{@type}[#{@name}]##{@action}", chef_resource_name: @name, chef_resource_type: @type, chef_resource_cookbook: @cookbook_name, chef_resource_recipe: @cookbook_recipe, chef_resource_action: @action, chef_resource_guard: @guard_description, chef_resource_duration_ms: @duration_ms, chef_resource_error_output: @error_output, chef_resource_error_source: @error_source, chef_resource_retries: @retries, chef_resource_notified_by: @notifying_resource, chef_resource_notified_via: @notification_type, chef_resource_before_notifications: @before_notifications, chef_resource_immediate_notifications: @immediate_notifications, chef_resource_delayed_notifications: @delayed_notifications, chef_resource_order: @execution_order, chef_resource_execution_phase: @execution_phase, chef_resource_started_at: @started_at, chef_resource_completed_at: @completed_at, chef_resource_status: @status } end
String and human friendly represtnation of the resource @return [String]
# File lib/sous_vide/tracked_resource.rb, line 83 def to_s "#{@type}[#{@name}]##{@action}" end