Description of problem: When accessing satellite as a non-admin user with custom roles configured, Host --> Host Collections --> Click on "Errata Installation" and it will show "There are no Errata associated with this Content Host to display." And it will log the following error in the logs. ~~ ActiveRecord::ConfigurationError: Can't join 'Katello::ContentFacetRepository' to association named 'hostgroup'; perhaps you misspelled it? ~~ Version: Satellite 6.9 How reproducible: Always Steps to Reproduce: 1. Register a host with Satellite 6.9 and ensure it has some installable updates available. 2. Associate the host with a hostgroup named "Test" and host_collection name "Patch" 3. Create a custom role with following permissions and filters. ~~ ----|-------------------------|------------------|------------|-----------|---------|--------------------------------------------------------------------------------- ID | RESOURCE TYPE | SEARCH | UNLIMITED? | OVERRIDE? | ROLE | PERMISSIONS ----|-------------------------|------------------|------------|-----------|---------|--------------------------------------------------------------------------------- 348 | JobInvocation | none | yes | no | ospatch | create_job_invocations, view_job_invocations 350 | Host | hostgroup = Test | no | no | ospatch | view_hosts, edit_hosts 351 | Katello::HostCollection | none | no | no | ospatch | view_host_collections, create_host_collections, edit_host_collections, destro... 353 | Location | none | no | no | ospatch | view_locations 354 | Organization | none | no | no | ospatch | view_organizations 357 | Hostgroup | name = Test | no | no | ospatch | view_hostgroups, destroy_hostgroups ----|-------------------------|------------------|------------|-----------|---------|--------------------------------------------------------------------------------- ~~ 4. Create a user called "Patch-Admin" and add the role "ospatch" to that user. 5. Login to satellite as "Patch-Admin" user and access Host --> Host Collections --> Patch --> Click on "Errata Installation" Actual results: In GUI --> "There are no Errata associated with this Content Host to display." In production.log ~~ 2021-06-11T00:14:26 [I|app|39d0c057] Started POST "/api/v2/hosts/bulk/installable_errata" for 10.74.X.X at 2021-06-11 00:14:26 +0530 2021-06-11T00:14:26 [I|app|39d0c057] Processing by Katello::Api::V2::HostsBulkActionsController#installable_errata as HTML 2021-06-11T00:14:26 [I|app|39d0c057] Parameters: {"included"=>{"search"=>"host_collection_id = 1", "ids"=>[2]}, "paged"=>true, "page"=>"1", "per_page"=>"20", "search"=>"", "organization_id"=>"1", "api_version"=>"v2", "hosts_bulk_action"=>{"included"=>{"search"=>"host_collection_id = 1", "ids"=>[2]}, "paged"=>true, "page"=>"1", "per_page"=>"20", "search"=>"", "organization_id"=>"1"}} 2021-06-11T00:14:26 [E|app|39d0c057] ActiveRecord::ConfigurationError: Can't join 'Katello::ContentFacetRepository' to association named 'hostgroup'; perhaps you misspelled it? 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/associations/join_dependency.rb:201:in `find_reflection' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/associations/join_dependency.rb:206:in `block in build' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/associations/join_dependency.rb:205:in `each' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/associations/join_dependency.rb:205:in `map' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/associations/join_dependency.rb:205:in `build' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/associations/join_dependency.rb:69:in `initialize' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/query_methods.rb:1020:in `new' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/query_methods.rb:1020:in `construct_join_dependency' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/finder_methods.rb:373:in `apply_join_dependency' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder/relation_handler.rb:8:in `call' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:55:in `build' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:109:in `block in expand_from_hash' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:68:in `each' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:68:in `flat_map' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:68:in `expand_from_hash' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:70:in `block in expand_from_hash' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:68:in `each' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:68:in `flat_map' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:68:in `expand_from_hash' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/predicate_builder.rb:21:in `build_from_hash' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/where_clause_factory.rb:19:in `build' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/query_methods.rb:656:in `where!' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/query_methods.rb:649:in `where' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/applicable_content_helper.rb:45:in `installable_for_hosts' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/models/katello/erratum.rb:102:in `installable_for_hosts' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb:114:in `installable_errata' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action' 39d0c057 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:195:in `process_action' ~~ Expected results: It should show the available errata's to install. Additional info: * I cannot reproduce this on Satellite 6.7.5. So it could be a regression. * I can avoid this issue from happening on Satellite 6.9.2 if I removed the hostgroup based search_filters from the custom role. * I doubt it has something to do with the introduction of katello_hostgroup_content_facets table since 6.9. Maybe something at code level is not properly mapped.
Connecting redmine issue https://projects.theforeman.org/issues/33940 from this bug
Upstream bug assigned to paji
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33940 has been resolved.
Verified Version Tested: Satellite 6.12.0 snap 13 1. Register a host with Satellite 6.9 and ensure it has some installable updates available. 2. Associate the host with a hostgroup named "Test" and host_collection name "Patch" 3. Create a custom role with following permissions and filters. ~~ ----|-------------------------|------------------|------------|-----------|---------|--------------------------------------------------------------------------------- ID | RESOURCE TYPE | SEARCH | UNLIMITED? | OVERRIDE? | ROLE | PERMISSIONS ----|-------------------------|------------------|------------|-----------|---------|--------------------------------------------------------------------------------- 348 | JobInvocation | none | yes | no | ospatch | create_job_invocations, view_job_invocations 350 | Host | hostgroup = Test | no | no | ospatch | view_hosts, edit_hosts 351 | Katello::HostCollection | none | no | no | ospatch | view_host_collections, create_host_collections, edit_host_collections, destro... 353 | Location | none | no | no | ospatch | view_locations 354 | Organization | none | no | no | ospatch | view_organizations 357 | Hostgroup | name = Test | no | no | ospatch | view_hostgroups, destroy_hostgroups ----|-------------------------|------------------|------------|-----------|---------|--------------------------------------------------------------------------------- ~~ 4. Create a user called "Patch-Admin" and add the role "ospatch" to that user. 5. Login to satellite as "Patch-Admin" user and access Host --> Host Collections --> Patch --> Click on "Errata Installation" Results: The errata’s that are available to install are displayed
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: Satellite 6.12 Release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:8506