Created
June 26, 2017 15:13
-
-
Save iNecas/2a20c8160debb598a1a7705ac89abb21 to your computer and use it in GitHub Desktop.
Get raw action data from task in JSON format.
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
# Get raw action data from task in JSON format. | |
# | |
# usage: | |
# | |
# TASK_IDS="TASK_ID_1,TASK_ID_2" \ | |
# foreman-rake console 2>/dev/null < foreman_tasks_extract_data.rb | \ | |
# grep "^OUT: " | sed "s/^OUT: //g" | |
task_ids = ENV['TASK_IDS'].split(',').map(&:strip) | |
tasks = ForemanTasks::Task.where(:id => task_ids) | |
puts("OUT: " + tasks.map do |t| | |
{:task_id => t.id, | |
:actions => t.execution_plan.actions.map do |h| | |
h.to_hash.slice(:class, :id, :input, :output) | |
end } | |
end.to_json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment