Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active March 24, 2017 13:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlsherrill/3804bcf080eeccdb661e9a0bd5de9b28 to your computer and use it in GitHub Desktop.
Save jlsherrill/3804bcf080eeccdb661e9a0bd5de9b28 to your computer and use it in GitHub Desktop.
remove_missing_repos.md
foreman-rake console
User.current = User.first

::Katello::Repository.all.each do |repo|
  begin
    puts "Checking #{repo.name} - #{repo.id}"
    Katello.pulp_server.extensions.repository.retrieve_with_details(repo.pulp_id)
  rescue RestClient::ResourceNotFound
    puts "Deleting #{repo.name} - #{repo.id}"
    repo.destroy!
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment