Class: ForemanPatch::Invocation
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ForemanPatch::Invocation
- Includes:
- ForemanTasks::Concerns::ActionSubject
- Defined in:
- app/models/foreman_patch/invocation.rb
Defined Under Namespace
Classes: Jail
Constant Summary collapse
- STATUSES =
%w(planned pending running success warning error cancelled)
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #events ⇒ Object
- #failed? ⇒ Boolean
- #phases ⇒ Object
- #success? ⇒ Boolean
- #to_action_input ⇒ Object
- #warning? ⇒ Boolean
Instance Method Details
#complete? ⇒ Boolean
39 40 41 |
# File 'app/models/foreman_patch/invocation.rb', line 39 def complete? ['success', 'warning', 'failed', 'cancelled'].include? status end |
#events ⇒ Object
35 36 37 |
# File 'app/models/foreman_patch/invocation.rb', line 35 def events task&.main_action&.live_output || [] end |
#failed? ⇒ Boolean
47 48 49 |
# File 'app/models/foreman_patch/invocation.rb', line 47 def failed? status == 'error' end |
#phases ⇒ Object
31 32 33 |
# File 'app/models/foreman_patch/invocation.rb', line 31 def phases task&.main_action&.planned_actions || [] end |
#success? ⇒ Boolean
51 52 53 |
# File 'app/models/foreman_patch/invocation.rb', line 51 def success? status == 'success' end |
#to_action_input ⇒ Object
55 56 57 58 59 60 |
# File 'app/models/foreman_patch/invocation.rb', line 55 def to_action_input { id: id, name: host.name } end |
#warning? ⇒ Boolean
43 44 45 |
# File 'app/models/foreman_patch/invocation.rb', line 43 def warning? status == 'warning' end |