Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active September 28, 2018 14:01
Show Gist options
  • Save jlsherrill/c23e8503a8070f97a516 to your computer and use it in GitHub Desktop.
Save jlsherrill/c23e8503a8070f97a516 to your computer and use it in GitHub Desktop.
Repositories in pulp, not in katello

To see the list of repo ids in pulp that are not in katello:

# foreman-rake console

> User.current = User.anonymous_admin
> Katello.pulp_server.resources.repository.retrieve_all.map{|i| i['id']} - Katello::Repository.pluck(:pulp_id) - Katello::ContentViewPuppetEnvironment.pluck(:pulp_id)

To remove said repositories

> (Katello.pulp_server.resources.repository.retrieve_all.map{|i| i['id']} - Katello::Repository.pluck(:pulp_id) - Katello::ContentViewPuppetEnvironment.pluck(:pulp_id)).each{|pulp_id| Katello.pulp_server.resources.repository.delete(pulp_id)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment