-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
6.16.0
Description of problem:
A host group is leveraging erb syntax for several of its parameters. An example of the erb synxtax used for one of the parameters:
Name Value dns_primary <%= @host.subnet.dns_primary %>
This is working when the host group is attached to a host.
However, when trying to use the host group in the global registration template, an error is thrown:
Danger alert: There was an error while loading the data, see the logs for more information.
The production.log shows this error:
2025-07-23T16:44:56 [I|app|968d8e6d] Started GET "/hosts/register/data?organization_id=1&location_id=2&hostgroup_id=1" for 192.168.0.43 at 2025-07-23 16:44:56 -0600 2025-07-23T16:44:56 [I|app|968d8e6d] Processing by RegistrationCommandsController#form_data as JSON 2025-07-23T16:44:56 [I|app|968d8e6d] Parameters: \{"organization_id"=>"1", "location_id"=>"2", "hostgroup_id"=>"1"} 2025-07-23T16:44:56 [W|app|968d8e6d] undefined method '#dns_primary' for NilClass::Jail (NilClass) 2025-07-23T16:44:56 [I|app|968d8e6d] Backtrace for 'undefined method '#dns_primary' for NilClass::Jail (NilClass)' error (Safemode::NoMethodError): undefined method '#dns_primary' for NilClass::Jail (NilClass) 968d8e6d | /usr/share/gems/gems/safemode-1.5.0/lib/safemode/jail.rb:22:in `method_missing' 968d8e6d | Unnamed:53:in `initialize' 968d8e6d | /usr/share/gems/gems/safemode-1.5.0/lib/safemode.rb:52:in `eval' 968d8e6d | /usr/share/gems/gems/safemode-1.5.0/lib/safemode.rb:52:in `eval' 968d8e6d | /usr/share/foreman/app/services/foreman/renderer/safe_mode_renderer.rb:7:in `render' 968d8e6d | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in `render' 968d8e6d | /usr/share/foreman/app/services/foreman/renderer.rb:46:in `render' 968d8e6d | /usr/share/foreman/app/services/parameter_safe_render.rb:43:in `render_string' 968d8e6d | /usr/share/foreman/app/services/parameter_safe_render.rb:27:in `render_object' 968d8e6d | /usr/share/foreman/app/services/parameter_safe_render.rb:31:in `block in render_object' 968d8e6d | /usr/share/foreman/app/services/parameter_safe_render.rb:31:in `merge' 968d8e6d | /usr/share/foreman/app/services/parameter_safe_render.rb:31:in `render_object' 968d8e6d | /usr/share/foreman/app/services/parameter_safe_render.rb:12:in `render' 968d8e6d | /usr/share/foreman/app/models/concerns/host_params.rb:65:in `host_params' 968d8e6d | /usr/share/foreman/app/models/concerns/host_params.rb:11:in `params' 968d8e6d | /usr/share/foreman/app/controllers/concerns/foreman/controller/registration_commands.rb:81:in `host_config_params' 968d8e6d | /usr/share/foreman/app/controllers/registration_commands_controller.rb:13:in `form_data' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/base.rb:215:in `process_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/rendering.rb:165:in `process_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/callbacks.rb:234:in `block in process_action' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:118:in `block in run_callbacks' 968d8e6d | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks' 968d8e6d | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks' 968d8e6d | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks' 968d8e6d | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in `around' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks' 968d8e6d | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in `around' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in `block in run_callbacks' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:138:in `run_callbacks' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/callbacks.rb:233:in `process_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/rescue.rb:23:in `process_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in `block in instrument' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in `instrument' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/instrumentation.rb:66:in `process_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/params_wrapper.rb:259:in `process_action' 968d8e6d | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/base.rb:151:in `process' 968d8e6d | /usr/share/gems/gems/actionview-7.0.8.7/lib/action_view/rendering.rb:39:in `process' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal.rb:188:in `dispatch' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal.rb:251:in `dispatch' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:49:in `dispatch' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:32:in `serve' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:50:in `block in serve' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in `each' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in `serve' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:852:in `call' 968d8e6d | /usr/share/gems/gems/katello-4.16.0.2/lib/katello/middleware/organization_created_enforcer.rb:18:in `call' 968d8e6d | /usr/share/gems/gems/katello-4.16.0.2/lib/katello/middleware/event_daemon.rb:10:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call' 968d8e6d | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/static_dispatcher.rb:74:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in `call' 968d8e6d | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call' 968d8e6d | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call' 968d8e6d | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/tempfile_reaper.rb:15:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/etag.rb:27:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/conditional_get.rb:27:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/head.rb:12:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/http/permissions_policy.rb:38:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/http/content_security_policy.rb:39:in `call' 968d8e6d | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/session/abstract/id.rb:266:in `context' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/session/abstract/id.rb:260:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/cookies.rb:704:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:99:in `run_callbacks' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/show_exceptions.rb:29:in `call' 968d8e6d | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/rack/logger.rb:40:in `call_app' 968d8e6d | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/rack/logger.rb:27:in `call' 968d8e6d | /usr/share/gems/gems/sprockets-rails-3.5.2/lib/sprockets/rails/quiet_assets.rb:17:in `call' 968d8e6d | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/remote_ip.rb:93:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/request_id.rb:26:in `call' 968d8e6d | /usr/share/gems/gems/katello-4.16.0.2/lib/katello/prevent_json_parsing.rb:12:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/method_override.rb:24:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/runtime.rb:22:in `call' 968d8e6d | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/executor.rb:14:in `call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/sendfile.rb:110:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/ssl.rb:77:in `call' 968d8e6d | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/host_authorization.rb:131:in `call' 968d8e6d | /usr/share/gems/gems/secure_headers-6.7.0/lib/secure_headers/middleware.rb:11:in `call' 968d8e6d | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/engine.rb:530:in `call' 968d8e6d | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in `public_send' 968d8e6d | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in `method_missing' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/urlmap.rb:74:in `block in call' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/urlmap.rb:58:in `each' 968d8e6d | /usr/share/gems/gems/rack-2.2.14/lib/rack/urlmap.rb:58:in `call' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/configuration.rb:279:in `call' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/request.rb:99:in `block in handle_request' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/thread_pool.rb:390:in `with_force_shutdown' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/request.rb:98:in `handle_request' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/server.rb:472:in `process_client' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/server.rb:254:in `block in run' 968d8e6d | /usr/share/gems/gems/puma-6.6.0/lib/puma/thread_pool.rb:167:in `block in spawn_thread' 968d8e6d | /usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context' 2025-07-23T16:44:56 [I|app|968d8e6d] Rendered common/500.html.erb (Duration: 1.2ms | Allocations: 535) 2025-07-23T16:44:56 [I|app|968d8e6d] Completed 500 Internal Server Error in 86ms (Views: 2.5ms | ActiveRecord: 11.9ms | Allocations: 25602)
How reproducible:
always
Is this issue a regression from an earlier version:
no
Steps to Reproduce:
1. Create a host group, and add a parameter which is using erb syntax for its value.
2. The value for one of the parameters <%= @host.subnet.dns_primary %>
3. Try to use this host group in the global registration page.
Actual behavior:
Unable to use a host group which is leveraging erb syntax in one of its parameters in the Satellite's global registration page.
Expected behavior:
Expect for the global registration to allow a host group to use erb syntax.
Business Impact / Additional info:
This is preventing hosts from being registered with these parameters.