-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
6.16.z, 6.17.0
-
3
-
False
-
Moderate
-
Satellite Endeavour Sprint 7
-
sat-endeavour
-
None
-
None
-
None
-
Automated
-
No
Description:
No matter how we try, Whenever we try to register a system with Red Hat Satellite, The registration fails with error e.g.
Couldn't find User with 'id'=9 [WHERE (users.id IN (8,1,2,5,3,4,7,6,2,8,4,1,3,1))] (HTTP error code 404: Not Found)
This only happens, When host_owner setting is set to a default value i.e. a specific user but that user has been deleted from the database.
To say it in the other way, If a user was set as the host_owner in satellite setting, When we delete the user from webui or hammer, the `host_owner` setting is not unset and that leads to this issue.
Reproducible:
100% and this is a regression I believe. Because we landed the fix for this Jira https://issues.redhat.com/browse/SAT-21682 in 6.16
Steps:
- Create a user in satellite and give it admin rights
- Set the user as the `Host owner` in satellite settings
- Generate a command to register a system with satellite
- Delete the user with hammer or webui of satellite
- Try registering a host with the generated curl command.
Actual Behavior:
On client host
+ subscription-manager config --rhsm.package_profile_on_trans=1 + subscription-manager config --rhsm.report_package_profile=1 + grep --quiet full_refresh_on_yum /etc/rhsm/rhsm.conf + sed -i 's/full_refresh_on_yum\s*=.*$/full_refresh_on_yum = 1/g' /etc/rhsm/rhsm.conf + systemctl try-restart yggdrasil + true + subscription-manager register --org=RedHat --activationkey=RH9 Couldn't find User with 'id'=9 [WHERE (users.id IN (8,1,2,5,3,4,7,6,2,8,4,1,3,1))] (HTTP error code 404: Not Found) + cleanup_and_exit 1 + rm -f /tmp/tmp.rb2uVXFDxF + exit 1
On Satellite, production.log:
2025-05-21T18:48:37 [I|app|6cfd385b] Started POST "/rhsm/consumers?owner=RedHat&activation_keys=RH9" for x.x.y.z at 2025-05-21 18:48:37 +0530 2025-05-21T18:48:37 [I|app|6cfd385b] Processing by Katello::Api::Rhsm::CandlepinProxiesController#consumer_activate as JSON 2025-05-21T18:48:37 [I|app|6cfd385b] Parameters: {"type"=>"system", "name"=>"myclient.example.com", "facts"=>"[FILTERED]", "installedProducts"=>[{"productId"=>"479", "productName"=>"Red Hat Enterprise Linux for x86_64", "version"=>"9.5", "arch"=>"x86_64"}], "contentTags"=>["rhel-9", "rhel-9-x86_64"], "role"=>"Red Hat Enterprise Linux Server", "addOns"=>[], "usage"=>"Production", "serviceLevel"=>"Premium", "owner"=>"RedHat", "activation_keys"=>"RH9"} 2025-05-21T18:48:37 [E|kat|6cfd385b] ActiveRecord::RecordNotFound: Couldn't find User with 'id'=9 [WHERE (users.id IN (8,1,2,5,3,4,7,6,2,8,4,1,3,1))] 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/finder_methods.rb:357:in `raise_record_not_found_exception!' 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/finder_methods.rb:476:in `find_one' 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/finder_methods.rb:458:in `find_with_ids' 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/finder_methods.rb:69:in `find' 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/querying.rb:22:in `find' 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/core.rb:340:in `find' 6cfd385b | /usr/share/foreman/app/services/owner_classifier.rb:12:in `classify_owner' 6cfd385b | /usr/share/foreman/app/models/concerns/hostext/ownership.rb:47:in `owner_suggestion' 6cfd385b | /usr/share/foreman/app/models/concerns/hostext/ownership.rb:67:in `set_default_user' .. .. 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/transactions.rb:302:in `save!' 6cfd385b | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/suppressor.rb:48:in `save!' 6cfd385b | /usr/share/gems/gems/katello-4.14.0.12/app/services/katello/registration_manager.rb:180:in `register_host' 6cfd385b | /usr/share/gems/gems/katello-4.14.0.12/app/services/katello/registration_manager.rb:36:in `process_registration' 6cfd385b | /usr/share/gems/gems/katello-4.14.0.12/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:242:in `consumer_activate'
Expected Behavior:
When deleting a user, It should check all the relevant associations with the user and unset them e.g. Host Owner settings in this case.
Additional Info:
Unsetting the Host Owner value in satellite settings should resolve this issue.
# hammer settings set --name host_owner --value ''
- relates to
-
SAT-21682 Host owner not set correctly during registration
-
- Closed
-