foreman_tasks:cleanup leaves jobs in state 'queued'

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.2, 6.3, 6.4

Issue

  • Old job host details are cleaned after 30 days, but this also clears the job summary details and the status is changed to 'queued'.
  • Removing tasks using foreman-rake foreman_tasks:cleanup TASK_SEARCH="" AFTER=30d doesn't remove tasks completely.

Resolution

  • This issue is tracked by Red Hat internally. Please open a support case for further details.

Workaround

  • Execute the below foreman-rake command to clear the Satellite Remote Execution Jobs, which are in Queued state.
[root@satellite ~]# foreman-rake console <<END
jobs = JobInvocation.search_for("status = queued")
targeting_ids = jobs.pluck(:targeting_id)
jobs.each do |job|
  job.targeting_id = nil
  job.destroy
end
Targeting.where(:id => targeting_ids).destroy_all
END

For more KB articles/solutions related to Red Hat Satellite 6.x Remote Execution Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Remote Execution Issues

SBR
Product(s)
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.