Sha256: ac247158ba3a55e6d23b624adc2713ffcea5356b7f1150550c39e89dfcf9fbe8
Contents?: true
Size: 970 Bytes
Versions: 15
Compression:
Stored size: 970 Bytes
Contents
namespace :katello do desc "Cancels all running Pulp 2 to 3 migration tasks." task :pulp3_migration_abort => ["dynflow:client"] do migration_tasks = ForemanTasks::Task::DynflowTask.where(:label => "Actions::Pulp3::ContentMigration").where.not(:state => ["stopped", "paused"]) cancelled_tasks_count = 0 migration_tasks.each do |task| cancelled_task = false task.execution_plan.steps.each do |_number, step| if step.cancellable? && step.is_a?(Dynflow::ExecutionPlan::Steps::RunStep) ::ForemanTasks.dynflow.world.event(task.execution_plan.id, step.id, Dynflow::Action::Cancellable::Cancel) cancelled_task = true end end if ::Katello::ContentMigrationProgress.where(:task_id => task.id).update_all(:canceled => true) > 0 cancelled_task = true end cancelled_tasks_count += 1 if cancelled_task end puts _("\e[33mCancelled #{cancelled_tasks_count} tasks.\e[0m") end end
Version data entries
15 entries across 15 versions & 1 rubygems