[Katello] Can't Delete Package "NoMethodError: undefined method `repository_href' for nil:NilClass"

Hi! First lets check something, run foreman-rake console and run:

REPO_ID = 106
Katello::Pulp3::RepositoryReference.where(:root_repository_id => Katello::Repository.find(REPO_ID).root_id, :content_view_id => Katello::Repository.find(REPO_ID).organization.library )

make sure to set the REPO_ID to whatever your repository _id actually is. I’m expecting that will return nothing (or an empty array). If it returns something like:

[#<Katello::Pulp3::RepositoryReference:0x000000000c225c48
  id: 1,
  repository_href: "/pulp/api/v3/repositories/container/container/a403416e-b6e2-4670-aaca-e5d5f9afe842/",
  content_view_id: 1,
  root_repository_id: 1>]

Stop, and let us know. If it does return an empty array, you can run:

href = "/pulp/api/v3/repositories/rpm/rpm/3f33e4ad-c860-4535-bdf4-459f9b860669/"
Katello::Pulp3::RepositoryReference.create!(:root_repository_id => Katello::Repository.find(REPO_ID).root_id, :content_view_id => Katello::Repository.find(REPO_ID).organization.library.id, repository_href: href)

set ‘href’ equal to the first part of the string you got from the previous ‘version_href’ command chris asked you to run, so if you got:
/pulp/api/v3/repositories/rpm/rpm/0676d8d3-6782-4bfe-9a07-865a4048e13e/versions/1/”

remove the versions/1/ and the href would be:

href = "/pulp/api/v3/repositories/rpm/rpm/0676d8d3-6782-4bfe-9a07-865a4048e13e/"

I’d also be interested in getting a sosreport to look for any errors that may have caused this!

3 Likes