Search for content hosts using a repository

I have just wanted to check if I can clean up some of the older repositories which are not used anymore. However, I am puzzled that there seems to way to search for all content hosts using a certain repository, e.g. content hosts which have the postgresql 9.4 repository (which is part of my postgresql product containing all postgresql versions) enabled in their repository set.

Am I not seeing something or isn’t it possible at the moment?

Katello 3.16 & Foreman 2.1.2


Is there a hammer command to do this or a hammer command to see the repository set/overrides for a particular host?

You can see the repository sets for a host like this: hammer host subscription product-content --host-id=3 which would allow you to script your cleanup operations. You could find all the hosts with the subscription containing the repo(s) in question, then look up each of those hosts individually to see if it has the old repo set enabled. That’s the long way of saying our API doesn’t support what you want to do currently.

If I had to guess it has to do with the fact that the relationship between repository sets and content hosts are stored in Candlepin’s database, and all of our search functionality hinges on data being in Foreman’s database. I think it’s a good RFE though. Mind filing it in our redmine under the Katello project?