Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active September 28, 2018 14:01
Show Gist options
  • Save jlsherrill/85a9af692ff227319804 to your computer and use it in GitHub Desktop.
Save jlsherrill/85a9af692ff227319804 to your computer and use it in GitHub Desktop.
Removing missing Red Hat Repositories

It is recommend you have a backup before proceeding with these steps. There is no need to shut down any part of the application while performing these steps.

  1. Ensure that the repositories being deleted are not published in any content views. If there are any, please delete the Content View Versions including the affected repos.

  2. For each repository, find its id. This should be located by going to the Content > Products page, clicking on the product the repository is in, and then repository name itself. Notice the URL in the browser, it will look something like:

https://abed.example.com/products/91/repositories/29

the 29 in this example is the repository ID and 91 is the product id.

  1. Open a rails console:
foreman-rake console
  1. Run the following commands within the console:
 User.current = User.first
 ForemanTasks.sync_task(::Actions::Katello::Repository::Destroy, Katello::Repository.find(29))

If you would like to confirm that the task completed successfully, simply navigate to Monitor > Tasks and you should see a 'Delete repository' task.

  1. Repeat step 4) for each repository ID you wish to delete.

  2. Once all the repositories are complete, we'll want to reindex the products. Still in the rails console, run:

 ForemanTasks.sync_task(::Actions::ElasticSearch::Reindex, Katello::Product.find(91))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment