Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement