Render user data template for rocky9-test-001test..net task failed with the following error: undefined method `content_view' for nil:NilClass

ask failed with the following error: undefined method `content_view’ for nil:NilClass

I’m not sure where this is coming from. I have a content_view created, but i can’t create any VMs from the host now. This is a new install, and I’m not sure what i’m doing wrong. I had this working on my previous install, which I wiped out to reinstall this one with katello.

What version of Katello? There have been several content-view-related fixes recently.

If the host / hostgroup doesn’t have both content view and lifecycle environment assigned, it may help to assign both.

Can I see what the template looks like?

katello-4.9.0-1 and foreman 3.7.0 I assigned in both host and hsot group, but it seems to make no difference.
I’m happy to share the template- is there a best way to do this?

Copy-paste in a direct message would be fine

Hi,

I got the template you sent. But I don’t see anywhere in the template that it tries to call .content_view, so I’m still not sure what’s going on.

In /var/log/foreman/production.log can you possibly find the backtrace for the undefined method 'content_view’ for nil:NilClass error?

Sure, I tried to create again, and was able to capture this from the log:

2023-07-06T08:06:32 [W|app|ea604301] Rolling back due to a problem: [#<Orchestration::Task:0x00005587af75e220 @name="Render user data template for rocky-auto-001.test.net", @id="Render user data template for rocky-auto-001.test.net", @status="failed", @priority=2, @action=[#<Host::Managed id: nil, name: "rocky-auto-001.test.net", last_compile: nil, last_report: nil, updated_at: nil, created_at: nil, root_pass: [FILTERED], architecture_id: 1, operatingsystem_id: 3, ptable_id: nil, medium_id: nil, build: true, comment: "", disk: "", installed_at: nil, model_id: nil, hostgroup_id: 1, owner_id: 4, owner_type: "User", enabled: true, puppet_ca_proxy_id: nil, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: 1, puppet_proxy_id: nil, certname: nil, image_id: 1, organization_id: 1, location_id: 2, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: 4, provision_method: "image", grub_pass: nil, global_status: 0, lookup_value_matcher: [FILTERED], pxe_loader: "PXELinux BIOS", initiated_at: nil, build_errors: nil, creator_id: nil>, :setUserData], @created=1688648791.9649758, @timestamp=2023-07-06 13:06:32.154308881 UTC>]

From the log I’m interested in the above error, and the several lines after it.

2023-07-06T11:48:10 [I|app|f0855118] Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 1.0ms | Allocations: 1873)
2023-07-06T11:48:20 [I|app|223e1ef3] Started GET "/notification_recipients" for 10.9.32.84 at 2023-07-06 11:48:20 -0500
2023-07-06T11:48:20 [I|app|223e1ef3] Processing by NotificationRecipientsController#index as JSON
2023-07-06T11:48:20 [I|app|223e1ef3] Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 0.9ms | Allocations: 1873)
2023-07-06T11:48:27 [E|dyn|] Pruned 1 envelopes for invalidated world ec5dcf1b-7d94-4908-89ed-8f86dcd1fa2c
2023-07-06T11:48:27 [E|dyn|] Pruned 1 envelopes for invalidated world a9c9297f-671d-4c11-937a-c986fb982418
2023-07-06T11:48:27 [E|dyn|] Pruned 1 envelopes for invalidated world 46aaa17a-ef44-43ab-874a-66051fdb3bd7
2023-07-06T11:48:27 [I|app|] Everything ready for world: 4e0e2329-dbdf-4757-bb82-9d5760da68b3
2023-07-06T11:48:27 [I|dyn|] Performing validity checks
2023-07-06T11:48:27 [I|dyn|] Finished performing validity checks
2023-07-06T11:48:30 [I|app|b92696b9] Started GET "/notification_recipients" for 10.9.32.84 at 2023-07-06 11:48:30 -0500
2023-07-06T11:48:30 [I|app|b92696b9] Processing by NotificationRecipientsController#index as JSON
2023-07-06T11:48:30 [I|app|b92696b9] Completed 200 OK in 7ms (Views: 0.2ms | ActiveRecord: 0.8ms | Allocations: 1873)
2023-07-06T11:48:38 [I|app|e0dfbbee] Started POST "/hosts" for 10.9.32.84 at 2023-07-06 11:48:38 -0500
2023-07-06T11:48:38 [I|app|e0dfbbee] Processing by HostsController#create as */*
2023-07-06T11:48:39 [I|app|e0dfbbee] Rendering UserData template for rocky-auto-001.test.net
2023-07-06T11:48:39 [W|app|e0dfbbee] Render user data template for rocky-auto-001.test.net task failed with the following error: undefined method `content_view' for nil:NilClass
 e0dfbbee | /usr/share/gems/gems/katello-4.9.0/app/models/katello/host/info_provider.rb:38:in `content_view_info'
 e0dfbbee | /usr/share/gems/gems/katello-4.9.0/app/models/katello/host/info_provider.rb:17:in `host_info'
 e0dfbbee | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `block in info'
 e0dfbbee | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:25:in `each'
 e0dfbbee | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:25:in `info'
 e0dfbbee | /usr/share/foreman/app/services/foreman/renderer/scope/macros/host_template.rb:227:in `enc'
 e0dfbbee | /usr/share/foreman/app/services/foreman/renderer/scope/macros/host_template.rb:23:in `host_enc'
 e0dfbbee | /usr/share/gems/gems/safemode-1.3.7/lib/safemode/scope.rb:37:in `method_missing'
 e0dfbbee | Kickstart default user data:80:in `bind'
 e0dfbbee | /usr/share/gems/gems/safemode-1.3.7/lib/safemode.rb:51:in `eval'
 e0dfbbee | /usr/share/gems/gems/safemode-1.3.7/lib/safemode.rb:51:in `eval'
 e0dfbbee | /usr/share/foreman/app/services/foreman/renderer/safe_mode_renderer.rb:7:in `render'
 e0dfbbee | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in `render'
 e0dfbbee | /usr/share/foreman/app/services/foreman/renderer.rb:46:in `render'
 e0dfbbee | /usr/share/foreman/app/models/template.rb:172:in `render'
 e0dfbbee | /usr/share/foreman/app/models/host/base.rb:351:in `render_template'
 e0dfbbee | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:135:in `setUserData'
 e0dfbbee | /usr/share/foreman/app/models/concerns/orchestration.rb:227:in `execute'
 e0dfbbee | /usr/share/foreman/app/models/concerns/orchestration.rb:152:in `block in process'
 e0dfbbee | /usr/share/foreman/app/models/concerns/orchestration.rb:144:in `each'
 e0dfbbee | /usr/share/foreman/app/models/concerns/orchestration.rb:144:in `process'
 e0dfbbee | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:824:in `_run_save_callbacks'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/callbacks.rb:457:in `create_or_update'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/timestamp.rb:126:in `create_or_update'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/persistence.rb:474:in `save'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/validations.rb:47:in `save'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/transactions.rb:298:in `block in save'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/transactions.rb:298:in `save'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/suppressor.rb:44:in `save'
 e0dfbbee | /usr/share/foreman/app/models/concerns/foreman/sti.rb:26:in `save'
 e0dfbbee | /usr/share/foreman/app/controllers/hosts_controller.rb:100:in `create'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/base.rb:228:in `process_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 e0dfbbee | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 e0dfbbee | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 e0dfbbee | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 e0dfbbee | /usr/share/gems/gems/audited-5.3.3/lib/audited/sweeper.rb:16:in `around'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 e0dfbbee | /usr/share/gems/gems/audited-5.3.3/lib/audited/sweeper.rb:16:in `around'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/callbacks.rb:41:in `process_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `block in instrument'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `instrument'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 e0dfbbee | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/base.rb:165:in `process'
 e0dfbbee | /usr/share/gems/gems/actionview-6.1.7.3/lib/action_view/rendering.rb:39:in `process'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal.rb:190:in `dispatch'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal.rb:254:in `dispatch'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:32:in `each'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:32:in `serve'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:842:in `call'
 e0dfbbee | /usr/share/gems/gems/katello-4.9.0/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 e0dfbbee | /usr/share/gems/gems/katello-4.9.0/lib/katello/middleware/event_daemon.rb:10:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 e0dfbbee | /usr/share/gems/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 e0dfbbee | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/static_dispatcher.rb:68:in `call'
 e0dfbbee | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/extractor/recorder.rb:139:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:98:in `run_callbacks'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 e0dfbbee | /usr/share/gems/gems/railties-6.1.7.3/lib/rails/rack/logger.rb:37:in `call_app'
 e0dfbbee | /usr/share/gems/gems/railties-6.1.7.3/lib/rails/rack/logger.rb:28:in `call'
 e0dfbbee | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 e0dfbbee | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 e0dfbbee | /usr/share/gems/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 e0dfbbee | /usr/share/gems/gems/katello-4.9.0/lib/katello/prevent_json_parsing.rb:12:in `call'
 e0dfbbee | /usr/share/gems/gems/rack-2.2.7/lib/rack/method_override.rb:24:in `call'
 e0dfbbee | /usr/share/gems/gems/rack-2.2.7/lib/rack/runtime.rb:22:in `call'
 e0dfbbee | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
 e0dfbbee | /usr/share/gems/gems/rack-2.2.7/lib/rack/sendfile.rb:110:in `call'
 e0dfbbee | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 e0dfbbee | /usr/share/gems/gems/railties-6.1.7.3/lib/rails/engine.rb:539:in `call'
 e0dfbbee | /usr/share/gems/gems/railties-6.1.7.3/lib/rails/railtie.rb:207:in `public_send'
 e0dfbbee | /usr/share/gems/gems/railties-6.1.7.3/lib/rails/railtie.rb:207:in `method_missing'
 e0dfbbee | /usr/share/gems/gems/rack-2.2.7/lib/rack/urlmap.rb:58:in `call'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/configuration.rb:270:in `call'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/request.rb:98:in `block in handle_request'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/request.rb:97:in `handle_request'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/server.rb:431:in `process_client'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/server.rb:233:in `block in run'
 e0dfbbee | /usr/share/gems/gems/puma-6.2.2/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
 e0dfbbee | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2023-07-06T11:48:39 [I|app|e0dfbbee] ^[[1;32mDeface: [WARNING]^[[0m No :original defined for 'add_execution_interface_js', you should change its definition to include:
 e0dfbbee |  :original => 'ac3c64a7a3f555ffd6939179326e7666155bc5fc'
2023-07-06T11:48:39 [I|app|e0dfbbee] ^[[1;32mDeface: [WARNING]^[[0m No :original defined for 'ansible_roles_tab', you should change its definition to include:
 e0dfbbee |  :original => '8c63c5282ee199068bfd65475e13066ee981089a'
2023-07-06T11:48:39 [I|app|e0dfbbee] ^[[1;32mDeface: [WARNING]^[[0m No :original defined for 'ansible_roles_tab_content', you should change its definition to include:
 e0dfbbee |  :original => 'ac3c64a7a3f555ffd6939179326e7666155bc5fc'
2023-07-06T11:48:39 [I|app|e0dfbbee] ^[[1;32mDeface: [WARNING]^[[0m No :original defined for 'add_execution_interface', you should change its definition to include:
 e0dfbbee |  :original => 'dbe1da973bfb251a74b994e7ae11bc8d11502c97'
2023-07-06T11:48:40 [I|app|e0dfbbee] ^[[1;32mDeface: [WARNING]^[[0m No :original defined for 'hosts_select_media_type', you should change its definition to include:
 e0dfbbee |  :original => '2d9ab0e830d51c8cd4271ea3f3ade95cfbf3de75'
2023-07-06T11:48:40 [I|app|e0dfbbee] ^[[1;32mDeface: [WARNING]^[[0m No :original defined for 'hosts_select_synced_content', you should change its definition to include:
 e0dfbbee |  :original => '2d9ab0e830d51c8cd4271ea3f3ade95cfbf3de75'
2023-07-06T11:48:40 [I|app|e0dfbbee]   Rendered hosts/new.html.erb within layouts/application (Duration: 574.3ms | Allocations: 368687)
2023-07-06T11:48:40 [I|app|e0dfbbee]   Rendered layouts/base.html.erb (Duration: 30.9ms | Allocations: 30878)
2023-07-06T11:48:40 [I|app|e0dfbbee]   Rendered layout layouts/application.html.erb (Duration: 608.1ms | Allocations: 401029)
2023-07-06T11:48:40 [I|app|e0dfbbee] Completed 200 OK in 1566ms (Views: 584.2ms | ActiveRecord: 79.5ms | Allocations: 616537)
2023-07-06T11:48:40 [I|app|c83b4a80] Started GET "/tasks/e5ca650a-e004-4924-aeb7-041329c525fc" for 10.9.32.84 at 2023-07-06 11:48:40 -0500
2023-07-06T11:48:40 [I|app|c83b4a80] Processing by TasksController#show as */*
2023-07-06T11:48:40 [I|app|c83b4a80]   Parameters: {"id"=>"e5ca650a-e004-4924-aeb7-041329c525fc"}
2023-07-06T11:48:40 [I|app|c83b4a80] Completed 200 OK in 7ms (Views: 1.7ms | ActiveRecord: 0.8ms | Allocations: 2512)
2023-07-06T11:48:40 [I|app|3e46a4d1] Started GET "/ansible/ui_ansible_roles?search=&resource_name=Host" for 10.9.32.84 at 2023-07-06 11:48:40 -0500
2023-07-06T11:48:40 [I|app|d819ceac] Started GET "/api/v2/compute_resources/1-Vsphere%207WM/available_storage_domains" for 10.9.32.84 at 2023-07-06 11:48:40 -0500
2023-07-06T11:48:40 [I|app|2a8394dd] Started GET "/api/v2/compute_resources/1-Vsphere%207WM/available_storage_pods" for 10.9.32.84 at 2023-07-06 11:48:40 -0500
2023-07-06T11:48:40 [I|app|3e46a4d1] Processing by UiAnsibleRolesController#index as JSON
2023-07-06T11:48:40 [I|app|3e46a4d1]   Parameters: {"search"=>"", "resource_name"=>"Host"}
2023-07-06T11:48:40 [I|app|3e46a4d1]   Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 16.6ms | Allocations: 9336)
2023-07-06T11:48:40 [I|app|3e46a4d1] Completed 200 OK in 26ms (Views: 17.6ms | ActiveRecord: 1.4ms | Allocations: 12337)
2023-07-06T11:48:40 [I|app|d819ceac] Processing by Api::V2::ComputeResourcesController#available_storage_domains as JSON
2023-07-06T11:48:40 [I|app|d819ceac]   Parameters: {"apiv"=>"v2", "id"=>"1-Vsphere 7WM"}
2023-07-06T11:48:40 [I|app|2a8394dd] Processing by Api::V2::ComputeResourcesController#available_storage_pods as JSON
2023-07-06T11:48:40 [I|app|2a8394dd]   Parameters: {"apiv"=>"v2", "id"=>"1-Vsphere 7WM"}
2023-07-06T11:48:40 [W|app|d819ceac] Action failed
2023-07-06T11:48:40 [I|app|d819ceac] Backtrace for 'Action failed' error (NameError): uninitialized constant Fog::Vsphere::Compute::Datastore
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/inflector/methods.rb:287:in `const_get'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/inflector/methods.rb:287:in `block in constantize'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/inflector/methods.rb:283:in `each'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/inflector/methods.rb:283:in `inject'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/inflector/methods.rb:283:in `constantize'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb:12:in `rescue in load'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb:7:in `load'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:874:in `uncompress'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:796:in `value'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:379:in `block in read'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:726:in `block in instrument'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:205:in `instrument'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:726:in `instrument'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/cache.rb:366:in `read'
 d819ceac | /usr/share/foreman/app/services/compute_resource_cache.rb:34:in `read'
 d819ceac | /usr/share/foreman/app/services/compute_resource_cache.rb:19:in `cache'
 d819ceac | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:112:in `datastores'
 d819ceac | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:181:in `available_storage_domains'
 d819ceac | /usr/share/foreman/app/controllers/api/v2/compute_resources_controller.rb:183:in `available_storage_domains'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/base.rb:228:in `process_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 d819ceac | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d819ceac | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d819ceac | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d819ceac | /usr/share/gems/gems/audited-5.3.3/lib/audited/sweeper.rb:16:in `around'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d819ceac | /usr/share/gems/gems/audited-5.3.3/lib/audited/sweeper.rb:16:in `around'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/callbacks.rb:41:in `process_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `block in instrument'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 d819ceac | /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `instrument'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 d819ceac | /usr/share/gems/gems/activerecord-6.1.7.3/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/abstract_controller/base.rb:165:in `process'
 d819ceac | /usr/share/gems/gems/actionview-6.1.7.3/lib/action_view/rendering.rb:39:in `process'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal.rb:190:in `dispatch'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_controller/metal.rb:254:in `dispatch'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/mapper.rb:49:in `serve'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:32:in `each'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:32:in `serve'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:842:in `call'
 d819ceac | /usr/share/gems/gems/katello-4.9.0/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 d819ceac | /usr/share/gems/gems/katello-4.9.0/lib/katello/middleware/event_daemon.rb:10:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 d819ceac | /usr/share/gems/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 d819ceac | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/static_dispatcher.rb:68:in `call'
 d819ceac | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/extractor/recorder.rb:139:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/static.rb:24:in `call'
 d819ceac | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 d819ceac | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 d819ceac | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 d819ceac | /usr/share/gems/gems/rack-2.2.7/lib/rack/tempfile_reaper.rb:15:in `call'
 d819ceac | /usr/share/gems/gems/rack-2.2.7/lib/rack/etag.rb:27:in `call'
 d819ceac | /usr/share/gems/gems/rack-2.2.7/lib/rack/conditional_get.rb:27:in `call'
 d819ceac | /usr/share/gems/gems/rack-2.2.7/lib/rack/head.rb:12:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 d819ceac | /usr/share/gems/gems/actionpack-6.1.7.3/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
2023-07-06T11:48:00 [I|app|453a9890] Started GET "/notification_recipients" for 10.9.32.84 at 2023-07-06 11:48:00 -0500
2023-07-06T11:48:00 [I|app|453a9890] Processing by NotificationRecipientsController#index as JSON
2023-07-06T11:48:00 [I|app|453a9890] Completed 200 OK in 7ms (Views: 0.2ms | ActiveRecord: 1.0ms | Allocations: 1873)
2023-07-06T11:48:10 [I|app|f0855118] Started GET "/notification_recipients" for 10.9.32.84 at 2023-07-06 11:48:10 -0500
2023-07-06T11:48:10 [I|app|f0855118] Processing by NotificationRecipientsController#index as JSON
2023-07-06T11:48:10 [I|app|f0855118] Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 1.0ms | Allocations: 1873)
2023-07-06T11:48:20 [I|app|223e1ef3] Started GET "/notification_recipients" for 10.9.32.84 at 2023-07-06 11:48:20 -0500
2023-07-06T11:48:20 [I|app|223e1ef3] Processing by NotificationRecipientsController#index as JSON
2023-07-06T11:48:20 [I|app|223e1ef3] Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 0.9ms | Allocations: 1873)
2023-07-06T11:48:27 [E|dyn|] Pruned 1 envelopes for invalidated world ec5dcf1b-7d94-4908-89ed-8f86dcd1fa2c
2023-07-06T11:48:27 [E|dyn|] Pruned 1 envelopes for invalidated world a9c9297f-671d-4c11-937a-c986fb982418
2023-07-06T11:48:27 [E|dyn|] Pruned 1 envelopes for invalidated world 46aaa17a-ef44-43ab-874a-66051fdb3bd7
2023-07-06T11:48:27 [E|dyn|] invalid worlds found {"4e0e2329-dbdf-4757-bb82-9d5760da68b3"=>:valid, "3e7c704e-7833-44cf-a6f7-812d5ca35dc9"=>:valid, "1bdb5fcf-1234-44ac-88b9-7e0e7b6cca8f"=>:valid, "da74f98a-9e79-450b-a15e-8aa5d2f65e5f"=>:valid, "068f37fa-ec45-4e82-a240-4bbc2ee9f52b"=>:valid, "ec5dcf1b-7d94-4908-89ed-8f86dcd1fa2c"=>:invalidated, "a9c9297f-671d-4c11-937a-c986fb982418"=>:invalidated, "c6e26587-938f-4e98-a6dd-118392c9b04d"=>:valid, "2b21cea8-93e4-40b8-b14b-dc5c62b21c3f"=>:valid, "d3a01762-0eb4-4e04-be09-4e2a4d701327"=>:valid, "46aaa17a-ef44-43ab-874a-66051fdb3bd7"=>:invalidated}
2023-07-06T11:48:27 [I|app|] Everything ready for world: 4e0e2329-dbdf-4757-bb82-9d5760da68b3
2023-07-06T11:48:27 [I|dyn|] Performing validity checks
2023-07-06T11:48:27 [I|dyn|] Finished performing validity checks
2023-07-06T11:48:30 [I|app|b92696b9] Started GET "/notification_recipients" for 10.9.32.84 at 2023-07-06 11:48:30 -0500
2023-07-06T11:48:30 [I|app|b92696b9] Processing by NotificationRecipientsController#index as JSON
2023-07-06T11:48:30 [I|app|b92696b9] Completed 200 OK in 7ms (Views: 0.2ms | ActiveRecord: 0.8ms | Allocations: 1873)
2023-07-06T11:48:38 [I|app|e0dfbbee] Started POST "/hosts" for 10.9.32.84 at 2023-07-06 11:48:38 -0500
2023-07-06T11:48:38 [I|app|e0dfbbee] Processing by HostsController#create as */*
2023-07-06T11:48:38 [I|app|e0dfbbee]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"1/YenMH62P5agWmWtgqTkX788pwms1lc4el98YmX7BMRkukf9zGYcEcAUbGUsYPynNPRF6JOSQkEbR2kdCtREA==", "host"=>{"name"=>"rocky-auto-001", "organization_id"=>"1", "location_id"=>"2", "hostgroup_id"=>"1", "content_facet_attributes"=>{"content_source_id"=>"1", "lifecycle_environment_id"=>"1", "content_view_id"=>"2", "kickstart_repository_id"=>"9"}, "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "identifier"=>"", "name"=>"rocky-auto-001", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"10.9.1.111", "ip6"=>"", "managed"=>"0", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-705"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"2048", "firmware"=>"bios", "cluster"=>"ord-7wm-esx01.ord.company.com", "resource_pool"=>"Resources", "path"=>"/Datacenters/DevStagingQA/vm/OPS", "guest_id"=>"rockylinux_64Guest", "hardware_version"=>"vmx-19", "memoryHotAddEnabled"=>"1", "cpuHotAddEnabled"=>"1", "add_cdrom"=>"0", "boot_order"=>["network", "disk"], "start"=>"1", "annotation"=>"", "scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"VirtualLsiLogicController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"sizeGb\":30,\"datastore\":\"SSL-DevVM01\",\"storagePod\":null}]}", "image_id"=>"502afa78-bea8-daf3-32bf-b86041132280"}, "architecture_id"=>"1", "operatingsystem_id"=>"3", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}, "media_selector"=>"synced_content"}
2023-07-06T11:48:39 [I|app|e0dfbbee] Rendering UserData template for rocky-auto-001.test.net
2023-07-06T11:48:39 [W|app|e0dfbbee] Render user data template for rocky-auto-001.test.net task failed with the following error: undefined method `content_view' for nil:NilClass
2023-07-06T11:48:39 [I|app|e0dfbbee] Backtrace for 'Render user data template for rocky-auto-001.test.net task failed with the following error: undefined method `content_view' for nil:NilClass' error (NoMethodError): undefined method `content_view' for nil:NilClass

Thanks, that’s helpful! I think it’s something in this file that’s failing…

Can you confirm that the host in question is assigned both a content view and lifecycle environment?

Can you please confirm the exact steps you’re taking to reproduce the error?

Thanks very much for looking in to this.
Ok, so I’m creating a new host from a vmware template that is registered to foreman as “rocky”
The host I’m trying to create is in a host group called php 8.1
The host group sets a content view of “7WM”, and a Lifecycle Environment of “Library” (this is the default i believe, as i’ve not gotten far enough yet to work out how this will best work with our weird environments).
The content view itself, 7WM, has 3 repos in it, EPEL, Remi, and Rocky 9.2

If you create the host first without assigning to the host group, (but make sure to assign both CV & LCE), does that work?

If you create a host from a different hostgroup, does that work?

I can’t recreate this so far…

If you have your vm template unregistered from foreman and then save that as a template. Try to deploy a VM from the template then register to Foreman, does it cause any issues?

Usually, VM templates are just vms that have all the software you want on them then you register them somewhere instead of having them already registered. I could see that causing issues because they would all have the same UUID from subscription-manager.

I created a new host group, with cv / LCE but i got the same error.
I tried with a different host group, and then without. host group at all, but i see
" Unable to save * Render user data template for rocky-test.vk-test.net task failed with the following error: undefined method `content_view’ for nil:NilClass" both times.

Cintrix, the template I’m trying to use was never registered to Foreman. That said, I did now try to create a vm from that template, and then make that vm a template, then register it to foreman, but i’m seeing the same issue.

I had a thought: The Foreman/Katello current install guide says the install has to be started like this:

foreman-installer --scenario katello \
--foreman-initial-organization "My_Organization" \
--foreman-initial-location "My_Location" \
--foreman-initial-admin-username admin_user_name \
--foreman-initial-admin-password admin_password

When I tried to install like that, I’d get a “too many arguments” error every time, until i stripped it down to just

foreman-installer --scenario katello 

Could this be contributing to the issue I’m seeing now?

I’ve messed with this all weekend, but am still stuck. Any final ideas before we abandon foreman as a possible solution for our provisioning/management needs?

Only thing I can think of is some essential change was not included in your Katello. Are you using a release candidate 4.9? (what’s your version of rubygem-katello ?)

could you possibly also try with a different user data template?

Yes, 4.9, when I downloaded it I didn’t realize it was an RC. Would it be smarter to find the most recent stable software? I’m not sure I want to trust the company to a release candidate.

Version info:
rubygem-katello-4.9.0-1.el8.noarch

Do you recommend a specific template? I’m working mostly in the dark here, and am not sure what the best path is.

rubygem-katello-4.9.0-1.el8.noarch is GA (not a release candidate), so we’re good there. :+1:

I was just thinking try with any different template, since the error is during rendering of the template. It would be helpful to know if the issue happens with all templates or just certain ones (especially since I haven’t been able to reproduce it here.)

I am seeing the same error.
My environment is using libvirt and hoping to get cloud-init to kick off and run.
I am seeing the problem with a new install of F3.7/K4.9 and also with a upgrade to F3.8/K4.10.
I have tried various hostgroups and also no hostgroup but consistently get the same error.

Because this is an image based install there is no upfront need for a content view.
I have built the environment using ansible so if it helps I can provide the playbook and vars.