How to find out content-views association using postgres database queries in the Red Hat Satellite?

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6

Issue

  • How to find out content-views association in satellite using postgres database queries.
  • How to find out where the content views is being used ?

Resolution

Note: Following database queries are sensitive, hence use it carefully. Put proper content view ID/Name and other details in the following queries.

Note also that similar search is available by other means (WebUI, API, hammer) as well.

  • To Login into the database.
# su - postgres -c "psql foreman"  
  • To find out all details of the content-view. Such as ID, Organization id, Created and updated time with the date.
foreman=# SELECT * FROM katello_content_views WHERE name = 'ContentViewToDelete';
  • To find out the hosts which are using a CV named like content-view.
foreman=# SELECT H.name AS hostname,KCV.name as CV_name FROM hosts H, katello_content_facets KCF, katello_content_views KCV WHERE KCV.name LIKE '%content-view%' AND KCV.id = KCF.content_view_id AND KCF.host_id = H.id;
  • To find out the activation keys which are using this content-view, knowing the CV ID or name:
foreman=# SELECT * FROM katello_activation_keys WHERE content_view_id = 123;
foreman=# SELECT * FROM katello_activation_keys KAK, katello_content_views KCV WHERE KAK.content_view_id = KCV.id AND KCV.name = 'content-view';
  • To find out all associations of the content-view.
foreman=# SELECT * FROM katello_content_facets WHERE content_view_id= 123;

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

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.

Comments