Provisioning or updating a host in Red Hat Satellite 6 with non-admin user fails with : {"message": "resource have no errors"}, "msg": "Error while performing update on hosts: 500 Server Error: Internal Server Error for url: https://sat.redhat.com/api/
Environment
Satellite 6.10+
Issue
- Creating or updating a host with ansible role or api call fails if user used for api call or ansible playbook execution, which creates or edits host with parameters, does have only edit hosts deafult role assigned.
Run will end in
"Error while performing create on hosts: 500 Server Error: Internal Server Error for url: https://sat.redhat.com/api/hosts"}"
fatal: [sat.sysmgmt.lan -> localhost]: FAILED! => {"changed": false, "error": {"message": "resource have no errors"}, "msg": "Error while performing create on hosts: 500 Server Error: Internal Server Error for url: https://sat.redhat.com/api/hosts"}
partial trace log in foreman:
2022-09-20T10:32:20 [I|aud|f94725fd] Parameter (26) create event on name mqm_name
2022-09-20T10:32:20 [I|aud|f94725fd] Parameter (26) create event on value mqtestname
2022-09-20T10:32:20 [I|aud|f94725fd] Parameter (26) create event on reference_id 21
2022-09-20T10:32:20 [I|aud|f94725fd] Parameter (26) create event on hidden_value false
2022-09-20T10:32:20 [I|aud|f94725fd] Parameter (26) create event on key_type string
2022-09-20T10:32:20 [W|app|f94725fd] Rolling back due to exception during save
2022-09-20T10:32:20 [I|app|f94725fd] Backtrace for 'Rolling back due to exception during save' error (ActiveRecord::RecordInvalid): Validation failed:
f94725fd | /usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/autosave_association.rb:417:in `block in save_collection_association'
f94725fd | /usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/autosave_association.rb:397:in `each'
...
...
2022-09-20T10:32:20 [W|app|f94725fd] Action failed
2022-09-20T10:32:20 [I|app|f94725fd] Backtrace for 'Action failed' error (RuntimeError): resource have no errors
f94725fd | /usr/share/foreman/app/controllers/api/base_controller.rb:156:in `process_resource_error'
f94725fd | /usr/share/foreman/app/controllers/api/base_controller.rb:176:in `process_response'
f94725fd | /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:147:in `create'
f94725fd | /usr/share/gems/gems/actionpack-6.0.4.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
f94725fd | /usr/share/gems/gems/actionpack-6.0.4.7/lib/abstract_controller/base.rb:195:in `process_action'
...
...
2022-09-20T10:32:20 [I|app|f94725fd] Rendering api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout
2022-09-20T10:32:20 [I|app|f94725fd] Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (Duration: 7.6ms | Allocations: 6240)
2022-09-20T10:32:20 [I|app|f94725fd] Completed 500 Internal Server Error in 484ms (Views: 16.1ms | ActiveRecord: 73.1ms | Allocations: 138797)
Resolution
Add filter to the role used by non-admin user
Administer -> roles -> select role -> filters tab -> New filter -> Resource type -> Parameter -> edit_params create_params -> submit
If user has just Edit hosts defaut role, clone it first by selecting drop down arrow -> clone -> fill in name, for example Edit hosts and parametres
Then change used role on non-admin user
Administer -> users -> select user -> roles tab -> select new role
For more KB articles/solutions related to Red Hat Satellite 6.x Provisioning Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Provisioning related Issues
Root Cause
edit_params or create_params from Parametres permission is need for host creation if host parametres are edited or created
Error message is misleading and it is This content is not included.know bug
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.