How to identify content-view(s) which include a specific repository on Red Hat Satellite 6?
Environment
- Red Hat Satellite 6.x
Issue
How to identify content-view(s) which include a specific repository on Red Hat Satellite 6?
Resolution
Given the ID of the repository using the following command:
# hammer repository list
There are 2 options to identify the content-view(s) which include the repository:
1. Find Content view names with PSQL query
Search by repository id (replace <id>):
# su - postgres -c "psql foreman -c \"select cv.name from katello_repositories as r inner join katello_content_view_repositories as cvr on cvr.repository_id = r.id inner join katello_content_views as cv on cv.id = cvr.content_view_id where root_id = (select root_id from katello_repositories where id = <id>)\""
Search by root_repository id (replace <id>):
# su - postgres -c "psql foreman -c \"select cv.name from katello_repositories as r inner join katello_content_view_repositories as cvr on cvr.repository_id = r.id inner join katello_content_views as cv on cv.id = cvr.content_view_id where root_id = <id>;\""
Search by name (replace <name>):
# su - postgres -c "psql foreman -c \"select cv.name from katello_repositories as r inner join katello_content_view_repositories as cvr on cvr.repository_id = r.id inner join katello_content_views as cv on cv.id = cvr.content_view_id inner join katello_root_repositories as rr on rr.id = cvr.repository_id where rr.name = '<name>';\""
2. Find Content view names and versions using foreman-rake
Assuming X is the repository ID:
# foreman-rake console <<< cat << EOF
conf.echo = false
Katello::Repository.find(X).clones.each { |repo| puts "#{repo.content_view.name} - #{repo.content_view_version.version}"}
EOF
For more KB articles/solutions related to Red Hat Satellite 6.x Content View Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Content View Issues
For more KB articles/solutions related to Red Hat Satellite 6.x Repository Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Repository Issues.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.