Class: Chef::ActionCollection::ActionRecord
- Inherits:
-
Object
- Object
- Chef::ActionCollection::ActionRecord
- Defined in:
- lib/chef/action_collection.rb
Instance Attribute Summary collapse
-
#action ⇒ Symbol
# The action that was run (or scheduled to run in the case of “unprocessed” resources).
-
#after_resource ⇒ Chef::Resource
non custom-resources or resources that do not implement load_after_resource.
-
#conditional ⇒ Chef::Resource::Conditional
The conditional that caused the resource to be skipped.
-
#current_resource ⇒ Chef::Resource
for non-why-run-safe resources in why-run mode, or if load_current_resource itself threw an exception (which should be considered a bug in that load_current_resource implementation, but must be handled), or for unprocessed resources.
-
#elapsed_time ⇒ Numeric
The elapsed time in seconds with machine precision.
-
#error_description ⇒ Hash
JSON-formatted error description from the Chef::Formatters::ErrorMapper.
-
#exception ⇒ Exception
The exception that was thrown.
-
#nesting_level ⇒ Integer
The “nesting” level.
-
#new_resource ⇒ Chef::Resource
The declared resource state.
-
#status ⇒ Symbol
The status of the resource: - updated: ran and converged - up_to_date: skipped due to idempotency - skipped: skipped due to a conditional - failed: failed with an exception - unprocessed: resources that were not touched by a run that failed.
Instance Method Summary collapse
-
#initialize(new_resource, action, nesting_level) ⇒ ActionRecord
constructor
A new instance of ActionRecord.
-
#success? ⇒ Boolean
True if there was no exception.
Constructor Details
#initialize(new_resource, action, nesting_level) ⇒ ActionRecord
Returns a new instance of ActionRecord.
75 76 77 78 79 |
# File 'lib/chef/action_collection.rb', line 75 def initialize(new_resource, action, nesting_level) @new_resource = new_resource @action = action @nesting_level = nesting_level end |
Instance Attribute Details
#action ⇒ Symbol
Returns # The action that was run (or scheduled to run in the case of “unprocessed” resources).
42 43 44 |
# File 'lib/chef/action_collection.rb', line 42 def action @action end |
#after_resource ⇒ Chef::Resource
non custom-resources or resources that do not implement load_after_resource.
39 40 41 |
# File 'lib/chef/action_collection.rb', line 39 def after_resource @after_resource end |
#conditional ⇒ Chef::Resource::Conditional
Returns The conditional that caused the resource to be skipped.
54 55 56 |
# File 'lib/chef/action_collection.rb', line 54 def conditional @conditional end |
#current_resource ⇒ Chef::Resource
for non-why-run-safe resources in why-run mode, or if load_current_resource itself threw an exception (which should be considered a bug in that load_current_resource implementation, but must be handled), or for unprocessed resources.
35 36 37 |
# File 'lib/chef/action_collection.rb', line 35 def current_resource @current_resource end |
#elapsed_time ⇒ Numeric
Returns The elapsed time in seconds with machine precision.
51 52 53 |
# File 'lib/chef/action_collection.rb', line 51 def elapsed_time @elapsed_time end |
#error_description ⇒ Hash
Returns JSON-formatted error description from the Chef::Formatters::ErrorMapper.
48 49 50 |
# File 'lib/chef/action_collection.rb', line 48 def error_description @error_description end |
#exception ⇒ Exception
Returns The exception that was thrown.
45 46 47 |
# File 'lib/chef/action_collection.rb', line 45 def exception @exception end |
#nesting_level ⇒ Integer
The “nesting” level. Outer resources in recipe context are 0 here, while for every sub-resource_collection inside of a custom resource this number is incremented by 1. Resources that are fired via build-resource or manually creating and firing
73 74 75 |
# File 'lib/chef/action_collection.rb', line 73 def nesting_level @nesting_level end |
#new_resource ⇒ Chef::Resource
Returns The declared resource state.
29 30 31 |
# File 'lib/chef/action_collection.rb', line 29 def new_resource @new_resource end |
#status ⇒ Symbol
The status of the resource:
- updated: ran and converged
- up_to_date: skipped due to idempotency
- skipped: skipped due to a conditional
- failed: failed with an exception
- unprocessed: resources that were not touched by a run that failed
65 66 67 |
# File 'lib/chef/action_collection.rb', line 65 def status @status end |
Instance Method Details
#success? ⇒ Boolean
Returns true if there was no exception.
82 83 84 |
# File 'lib/chef/action_collection.rb', line 82 def success? !exception end |