-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
6.16.3
-
3
-
False
-
Moderate
-
sat-proton
-
None
-
None
-
None
-
To Do
Description of problem:
hammer rebuild-config command failed with following error.
hammer host rebuild-config --name host.example.com
ERF42-5227 [Foreman::Exception]: unknown parent permission for api/v2/hosts#build
It only happens if there is a default parameter ending with "_id" set in hammer. For example "organization_id" and "location_id"
# hammer default list
----------------|------
PARAMETER | VALUE
----------------|------
organization_id | 1
----------------|------
/var/log/foreman/production.log
2025-03-12T05:37:49 [I|app|7459a8ee] Processing by Api::V2::HostsController#rebuild_config as JSON
2025-03-12T05:37:49 [I|app|7459a8ee] Parameters: {"organization_id"=>"1", "apiv"=>"v2", "id"=>"66", "host"=>{"organization_id"=>"1"}}
2025-03-12T05:37:49 [W|app|7459a8ee] Action failed
2025-03-12T05:37:49 [I|app|7459a8ee] Backtrace for 'Action failed' error (Foreman::Exception): ERF42-5227 [Foreman::Exception]: unknown parent permission for api/v2/hosts#build
7459a8ee | /usr/share/foreman/app/controllers/api/base_controller.rb:407:in `parent_permission'
7459a8ee | /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:416:in `parent_permission'
7459a8ee | /usr/share/foreman/app/controllers/api/base_controller.rb:428:in `parent_resource_details'
7459a8ee | /usr/share/foreman/app/controllers/api/base_controller.rb:336:in `find_nested_object'
7459a8ee | /usr/share/foreman/app/controllers/api/base_controller.rb:330:in `find_optional_nested_object'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:427:in `block in make_lambda'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:179:in `block (2 levels) in halting_and_conditional'
7459a8ee | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:180:in `block in halting_and_conditional'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `block in invoke_before'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `each'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `invoke_before'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:115:in `block in run_callbacks'
7459a8ee | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
7459a8ee | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
7459a8ee | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
How reproducible:
Easy