Feature #7301
closedInfrastructure for bulk actions
Description
Foreman tasks should support triggering an action on a set of resources
and tracking the progress of the sub-tasks.
Implementation¶
There is a ::Actions::BulkAction
:
plan_action(::Actions::BulkAction, ActionToTriggerPerTarget, targets, *args)
This will plan the ActionToTriggerPerTarget
on every target from the
targets. By default, it uses the targets class and the id of the
targets for serializing the data into the input and loading the
objects back in the run phase. The *args are also passed as arguments
to the ActionToTriggerPerTarget
.
To customize the logic around serialization/deserialization of the
input targets and args, one can override the plan
andcreate_sub_plans
method.
The Task
model has parent_task reference to the task that planned it.
In bulk action task details there is a link to a list of subtasks
(/tasks/uuid/sub_tasks
), and in the sub task details, there is link
to the parent task.