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).
-
#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.
-
#exception ⇒ Exception
The exception that was thrown.
-
#nesting_level ⇒ Integer
The “nesting” level.
-
#new_resource ⇒ Chef::Resource
XXX: this is buggy since we (ab)use this resource for “after” state and it may be inaccurate and it may be mutated by the user.
-
#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.
72 73 74 75 76 |
# File 'lib/chef/action_collection.rb', line 72 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 |
#conditional ⇒ Chef::Resource::Conditional
Returns The conditional that caused the resource to be skipped.
51 52 53 |
# File 'lib/chef/action_collection.rb', line 51 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.
39 40 41 |
# File 'lib/chef/action_collection.rb', line 39 def current_resource @current_resource end |
#elapsed_time ⇒ Numeric
Returns The elapsed time in seconds with machine precision.
48 49 50 |
# File 'lib/chef/action_collection.rb', line 48 def elapsed_time @elapsed_time 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
70 71 72 |
# File 'lib/chef/action_collection.rb', line 70 def nesting_level @nesting_level end |
#new_resource ⇒ Chef::Resource
XXX: this is buggy since we (ab)use this resource for “after” state and it may be inaccurate and it may be mutated by the user. A third after_resource should be added to new_resource + current_resource to properly implement this.
33 34 35 |
# File 'lib/chef/action_collection.rb', line 33 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
62 63 64 |
# File 'lib/chef/action_collection.rb', line 62 def status @status end |
Instance Method Details
#success? ⇒ Boolean
Returns true if there was no exception.
79 80 81 |
# File 'lib/chef/action_collection.rb', line 79 def success? !exception end |