Cannot delete "orphaned" RedHat repository

Katello 3.18. I needed to wipe out my redhat setup and start over. All good, except in the process my two repositories for redhat8 are now stuck in limbo. They show up as “orphaned”, and I cannot delete them.

Is there an override of some sort I can use to get rid of these? When I try to delete them I get an error that the repo is not found.

2021-08-06T16:27:03 [I|bac|] Task {label: Actions::Katello::RepositorySet::DisableRepository, id: a2c282a2-7e0c-47a7-a204-a1a3482255a9,                                   execution_plan_id: 43140f55-b91e-44fb-a98b-28ea0360f0e6} state changed: stopped  result: error
2021-08-06T16:27:03 [E|app|] Katello::Errors::NotFound: Repository not found

The repository seems to have been deleted already. Are you seeing any issues with the environment after the task failed?

Yes, since the entries are still there, I cannot delete the product(s), because the repo entries (2 of them) still exist as orphaned. I cannot delete them.

Does the Redhat Repository page still show those as enabled as well?

An attempted delete of either one gives this simple error only.

Oh…That’s helpful…Seems like the enabled repository set did not create a repository with all mapping fields or something left the data in a bad state.
Did you delete the manifest etc? Just curious as to how you reached this state and if we can reproduce and file an issue for this.

For now, you could open a foreman-rake console and do this:
ForemanTasks.sync_task(::Actions::Katello::Repository::Destroy, Katello::Repository.find(ID))

where you can get the ID from the URL of the Content> Product> Repository > repo record

You’ll need to run this twice for both the repository records. Let me know if that works.

2 Likes

Hmm, having issues, I tried the backend ID, also tried the URL. Getting errors. In my case here, what is considered tthe “ID” ?

Hi, I finally figured it out, the repo ID is not displayed in that screen at all. I instead found the repository ID’s using “hammer repository list”; the deletion of them finaly worked using the cosole command you provided above. Thank you!

And yes, to answer a question above, I had indeed deleted the manifest which is interesting; it let me delete most of the associated repo’s afterward, just not all of them. Go figure.

It’s in the URL. If you check the URL in the address bar for that page you see something like:

https://foreman.example.com/products/13/repositories/2093

2093 is the ID of the repository. 13 is the ID of the product…

1 Like

In the URL the digits immediately following the /repositories/…
Ex: 1 in the URL below:
https://server.com/products/290/repositories/1