Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Created January 18, 2022 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlsherrill/f5bc83ecb48ba4f60a34e19d342ce3f7 to your computer and use it in GitHub Desktop.
Save jlsherrill/f5bc83ecb48ba4f60a34e19d342ce3f7 to your computer and use it in GitHub Desktop.
delete repository references on 404
foreman-rake console
Katello::Pulp3::RepositoryReference.all.select do |ref|
  api = Katello::RepositoryTypeManager.repository_types[ref.root_repository.content_type].pulp3_api_class.new(SmartProxy.pulp_primary)
  api.repositories_api.read(ref.repository_href)  
rescue => e
   if e&.code == 404
     ref.destroy
   end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment