Class: Actions::Base
- Inherits:
-
Dynflow::Action
- Object
- Dynflow::Action
- Actions::Base
- Defined in:
- app/lib/actions/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #already_running? ⇒ Boolean
-
#humanized_errors ⇒ Object
This method should return String or Array<String> describing the errors during the action.
-
#humanized_input ⇒ Object
This method should return String or Array<String> describing input for the task.
-
#humanized_name ⇒ Object
This method should return humanized description of the action, e.g.
-
#humanized_output ⇒ Object
This method should return String describing output for the task.
- #task ⇒ Object
-
#task_input ⇒ Object
This method says what data form input gets into the task details in Rest API By default, it sends the whole input there.
-
#task_output ⇒ Object
This method says what data form output gets into the task details in Rest API It should aggregate the important data that are worth to propagate to Rest API, perhaps also aggraget data from subactions if needed (using
all_actions) method of Dynflow::Action::Presenter.
Instance Method Details
#already_running? ⇒ Boolean
54 55 56 57 |
# File 'app/lib/actions/base.rb', line 54 def already_running? ForemanTasks::Task::DynflowTask.for_action(self.class). running.where('external_id != ?', execution_plan_id).any? end |
#humanized_errors ⇒ Object
This method should return String or Array<String> describing the errors during the action
48 49 50 51 52 |
# File 'app/lib/actions/base.rb', line 48 def humanized_errors execution_plan.steps_in_state(:skipped, :skipping, :error).map do |step| step.error. if step.error end.compact end |
#humanized_input ⇒ Object
This method should return String or Array<String> describing input for the task
28 29 30 31 32 33 34 |
# File 'app/lib/actions/base.rb', line 28 def humanized_input if task_input.blank? "" else task_input.pretty_inspect end end |
#humanized_name ⇒ Object
This method should return humanized description of the action, e.g. “Install package”
23 24 25 |
# File 'app/lib/actions/base.rb', line 23 def humanized_name self.class.name.demodulize.underscore.humanize end |
#humanized_output ⇒ Object
This method should return String describing output for the task. It should aggregate the data from subactions as well and it’s used for humanized description of restuls of the action
39 40 41 42 43 44 45 |
# File 'app/lib/actions/base.rb', line 39 def humanized_output if task_output.blank? "" else task_output.pretty_inspect end end |
#task ⇒ Object
4 5 6 |
# File 'app/lib/actions/base.rb', line 4 def task @task ||= ::ForemanTasks::Task::DynflowTask.find_by_external_id!(execution_plan_id) end |
#task_input ⇒ Object
This method says what data form input gets into the task details in Rest API By default, it sends the whole input there.
10 11 12 |
# File 'app/lib/actions/base.rb', line 10 def task_input self.input end |
#task_output ⇒ Object
This method says what data form output gets into the task details in Rest API It should aggregate the important data that are worth to propagate to Rest API, perhaps also aggraget data from subactions if needed (using all_actions) method of Dynflow::Action::Presenter
18 19 20 |
# File 'app/lib/actions/base.rb', line 18 def task_output self.output end |