New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #9508 - use Dynflow sub-plans support for sub tasks and bulk actions #104
Conversation
There were the following issues with the commit message:
Guidelines are available on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
Depends on Dynflow/dynflow#145 |
Ran a test of fusor which uses ActionWithSubPlans and it ran cleanly, with no unexpected behaviors. This included both this PR and the referenced dynflow PR. |
if parent_task | ||
ret.concat(parent_task.with_parents) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would like to make things more complicated [self, *(parent_task.with_parents if parent_task)]
;)
1 noop and 1 minor, otherwise ACK |
…ulk actions Bulk actions is just one of the use-cases for using sub-plans. This patch extract the common code to be used for triggering external tasks in general. The usage is as follows: one needs to inherit it's action from the ``Actions::ActionWithSubPlans`` and override the ``create_sub_plans`` method. The ``create_sub_plans`` will be executed in run phase and the rest of the action will make sure that the execution of the action will wait till the sub plan is done. It also tracks the relation between parent and child tasks, as it already did in bulk actions. An example code could look like this (taken from real Katello actions): class SyncAsSubPlan < Actions::ActionWithSubPlans input_format do param :id, Integer end def plan(repository) plan_self(:id => repository.id) end def create_sub_plans trigger(Repository::Sync, ::Katello::Repository.find(input[:id])) end end
Comments addressed. Waiting for the CI, then merging and releasing new version of foreman-tasks |
Fixes #9508 - use Dynflow sub-plans support for sub tasks and bulk actions
@bbuckingham foreman-tasks 0.6.13 and dynflow 0.7.7 containt this change.The PR for foreman-packaging is here theforeman/foreman-packaging#582 |
Thanks @iNecas ! |
Bulk actions is just one of the use-cases for using sub-plans. This patch
extract the common code to be used for triggering external tasks in
general and moves that to the Dynflow.
The usage is as follows: one needs to inherit it's action from the
Actions::ActionWithSubPlans
and override thecreate_sub_plans
method. Thecreate_sub_plans
will be executed inrun phase and the rest of the action will make sure that the execution of
the action will wait till the sub plan is done. It also tracks the relation
between parent and child tasks, as it already did in bulk actions.
An example code could look like this (taken from real Katello actions):