Created
May 5, 2016 15:34
-
-
Save iNecas/956a632dad781d9044408cf59c445a2d to your computer and use it in GitHub Desktop.
resume_missing_pulp_task.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat <<EOF | foreman-rake console | |
@world = ForemanTasks.dynflow.world | |
@persistence = @world.persistence | |
def reset_pulp_task(uuid) | |
execution_plan = @persistence.load_execution_plan(uuid) | |
raise 'execution plan #{execution_plan} is not paused' unless execution_plan.state == :paused | |
active_steps = execution_plan.steps_in_state(:running, :suspended, :error) | |
active_steps.each do |step| | |
action = step.action(execution_plan) | |
if action.output['pulp_tasks'] | |
# delete a record about previous pulp tasks | |
action.output.delete('pulp_tasks') | |
puts "updating execution plan #{uuid} step #{step.id} action #{action.id}" | |
@persistence.save_action(execution_plan.id, action) | |
end | |
end | |
puts "resuming execution plan #{execution_plan.id}" | |
@world.execute(execution_plan.id) | |
end | |
reset_pulp_task('e038e0ae-4f3e-43c6-9d3d-3e40d3df8c15') | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note the argument to reset_pulp_task is dynflow UUID, not foreman task UUID - one can get the dynflow UUID by accessing external_id of the foreman task.