[Satellite 6] Couldn't find Katello::Repository with 'id'=xxxx

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6

Issue

  • Attempting to delete a file repository fails with error: Couldn't find Katello::Content without an ID xxxx

Resolution

  • Check if there are any stuck tasks on satellite server
 # su - postgres -c "psql -d foreman -c 'select label,count(label),state,result from foreman_tasks_tasks where state <> '\''stopped'\'' group by label,state,result ORDER BY label;'"
  • If you find any tasks running, Then run below command to clean the tasks
# foreman-rake foreman_tasks:cleanup TASK_SEARCH='label =' STATES='running,pending,planned,paused' VERBOSE=true
  • Once all the tasks are cleaned, Run below commands on Satellite server
 # foreman-rake katello:delete_orphaned_content --trace
 # foreman-rake katello:clean_backend_objects --trace
 # foreman-rake katello:correct_repositories COMMIT=true
 # satellite-maintain service restart

Root Cause

  1. Attempt to delete the repository gets stuck, and attempting to skip the task results in the error "Couldn't find Katello::Repository with 'id'=xxx indicates that there is no entry available in candlepin database therefore the subtask can be skipped and the remaining task can be resumed.

Diagnostic Steps

  • Check for the Error "Couldn't find Katello::Repository with 'id'=xxx " in Satellite task export
  • foreman-rake katello:correct_repositories COMMIT=false --trace

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.