Class: Actions::Base
- Inherits:
-
Dynflow::Action
- Object
- Dynflow::Action
- Actions::Base
- Includes:
- Helpers::LifecycleLogging
- 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.
- #notify_paused(*_args) ⇒ Object
- #serializer_class ⇒ Object
- #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.
Methods included from Helpers::LifecycleLogging
included, #log_task_state_change
Instance Method Details
#already_running? ⇒ Boolean
50 51 52 53 |
# File 'app/lib/actions/base.rb', line 50 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
44 45 46 47 48 |
# File 'app/lib/actions/base.rb', line 44 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
32 33 34 |
# File 'app/lib/actions/base.rb', line 32 def humanized_input '' end |
#humanized_name ⇒ Object
This method should return humanized description of the action, e.g. “Install package”
27 28 29 |
# File 'app/lib/actions/base.rb', line 27 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 |
# File 'app/lib/actions/base.rb', line 39 def humanized_output '' end |
#notify_paused(*_args) ⇒ Object
59 60 61 |
# File 'app/lib/actions/base.rb', line 59 def notify_paused(*_args) task.build_notifications.each(&:deliver!) if root_action? end |
#serializer_class ⇒ Object
55 56 57 |
# File 'app/lib/actions/base.rb', line 55 def serializer_class ::Actions::Serializers::ActiveRecordSerializer end |
#task ⇒ Object
8 9 10 |
# File 'app/lib/actions/base.rb', line 8 def task @task ||= ::ForemanTasks::Task::DynflowTask.where(:external_id => execution_plan_id).first! 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.
14 15 16 |
# File 'app/lib/actions/base.rb', line 14 def task_input 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
22 23 24 |
# File 'app/lib/actions/base.rb', line 22 def task_output output end |