Description of problem: Trying to download host bootdisk generic image gives error Failed to render boot disk template: undefined method `content_source' for #<struct token=nil, subnet=nil> Did you mean? contains_erb? Version-Release number of selected component (if applicable): Satellite 6.5 snap 22 How reproducible: always Steps to Reproduce: 1. Navigate to Host- > All hosts 2. Click on host 3. Click on Generic image/generic subnet image from bootdisk dropdown. Actual results: Error: Failed to render boot disk template: undefined method `content_source' for #<struct token=nil, subnet=nil> Did you mean? contains_erb? Expected results: Should able to download bootdisk image. Additional info:
2019-03-29T14:23:36 [I|app|] Started GET "/bootdisk/disks/generic" for IP at 2019-03-29 14:23:36 -0400 2019-03-29T14:23:36 [I|app|e55c9733] Processing by ForemanBootdisk::DisksController#generic as HTML 2019-03-29T14:23:36 [I|app|e55c9733] Current user set to admin (admin) 2019-03-29T14:23:36 [I|app|76a0dd77] Completed 200 OK in 35ms (Views: 0.3ms | ActiveRecord: 2.6ms) 2019-03-29T14:23:36 [W|app|e55c9733] Failed to render boot disk template NoMethodError: undefined method `content_source' for #<struct token=nil, subnet=nil> Did you mean? contains_erb? /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.36/app/services/katello/managed_content_medium_provider.rb:7:in `validate' /usr/share/foreman/app/services/medium_providers/provider.rb:54:in `errors' /usr/share/foreman/app/services/medium_providers/provider.rb:50:in `valid?' /usr/share/foreman/app/registries/foreman/plugin/medium_providers_registry.rb:31:in `block in find_provider' /usr/share/foreman/app/registries/foreman/plugin/medium_providers_registry.rb:31:in `select' /usr/share/foreman/app/registries/foreman/plugin/medium_providers_registry.rb:31:in `find_provider' /usr/share/foreman/lib/foreman/renderer/scope/variables/base.rb:28:in `load_variables_base' /usr/share/foreman/lib/foreman/renderer/scope/variables.rb:20:in `block in load_variables' /usr/share/foreman/lib/foreman/renderer/scope/variables.rb:18:in `each' /usr/share/foreman/lib/foreman/renderer/scope/variables.rb:18:in `load_variables' /usr/share/foreman/lib/foreman/renderer/scope/base.rb:27:in `initialize' /usr/share/foreman/lib/foreman/renderer/scope/template.rb:9:in `initialize' /usr/share/foreman/lib/foreman/renderer.rb:39:in `new' /usr/share/foreman/lib/foreman/renderer.rb:39:in `get_scope' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_bootdisk-14.0.0.1/app/services/foreman_bootdisk/renderer.rb:27:in `render_template' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_bootdisk-14.0.0.1/app/services/foreman_bootdisk/renderer.rb:19:in `generic_template_render' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_bootdisk-14.0.0.1/app/controllers/foreman_bootdisk/disks_controller.rb:15:in `generic' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks' /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/mapper.rb:48:in `serve' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/static_dispatcher.rb:65:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/extractor/recorder.rb:137:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /usr/share/foreman/lib/middleware/telemetry.rb:9:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/tempfile_reaper.rb:15:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/conditional_get.rb:25:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/head.rb:12:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call' /usr/share/foreman/lib/middleware/logging_context.rb:23:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.36/lib/katello/prevent_json_parsing.rb:12:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.0.0/lib/secure_headers/middleware.rb:13:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call' /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request' /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop' /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads' /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
]# rpm -qa | grep bootdisk tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-5.el7sat.noarch tfm-rubygem-foreman_bootdisk-14.0.0.1-1.el7sat.noarch
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26512 has been resolved.
REL-ENG: There are TWO small PRs related to this BZ - pls merge both. Will be clean merge, let me know if you need MR.
Version tested: Satellite 6.5 snap 23 Able to download the generic/ subnet boot disk image but production.log shows error as 2019-04-10T09:32:07 [I|app|] Started GET "/bootdisk/disks/subnet/rhel8host" for IP at 2019-04-10 09:32:07 -0400 2019-04-10T09:32:07 [I|app|8b23e43e] Processing by ForemanBootdisk::DisksController#subnet as HTML 2019-04-10T09:32:07 [I|app|8b23e43e] Parameters: {"id"=>"rhel8host"} 2019-04-10T09:32:07 [I|app|8b23e43e] Current user set to admin (admin) 2019-04-10T09:32:07 [E|app|8b23e43e] Could not find a provider for #<struct token=nil, provision_interface=#<struct subnet=#<Subnet::Ipv4 id: 2, network: "192.168.100.0", mask: "255.255.255.0", priority: nil, name: "foreman", vlanid: nil, created_at: "2019-04-06 05:25:44", updated_at: "2019-04-06 09:23:42", dhcp_id: 1, tftp_id: 1, gateway: "192.168.100.1", dns_primary: "192.168.100.1", dns_secondary: "", from: "", to: "", dns_id: 1, boot_mode: "DHCP", ipam: "DHCP", discovery_id: 1, type: "Subnet::Ipv4", description: "", mtu: 1500, template_id: 1, httpboot_id: nil>>, content_source=nil>. Providers returned {"Katello::ManagedContentMediumProvider"=>["Kickstart repository was not set for host '#<struct token=nil, provision_interface=#<struct subnet=#<Subnet::Ipv4 id: 2, network: \"192.168.100.0\", mask: \"255.255.255.0\", priority: nil, name: \"foreman\", vlanid: nil, created_at: \"2019-04-06 05:25:44\", updated_at: \"2019-04-06 09:23:42\", dhcp_id: 1, tftp_id: 1, gateway: \"192.168.100.1\", dns_primary: \"192.168.100.1\", dns_secondary: \"\", from: \"\", to: \"\", dns_id: 1, boot_mode: \"DHCP\", ipam: \"DHCP\", discovery_id: 1, type: \"Subnet::Ipv4\", description: \"\", mtu: 1500, template_id: 1, httpboot_id: nil>>, content_source=nil>'", "Content source was not set for host '#<struct token=nil, provision_interface=#<struct subnet=#<Subnet::Ipv4 id: 2, network: \"192.168.100.0\", mask: \"255.255.255.0\", priority: nil, name: \"foreman\", vlanid: nil, created_at: \"2019-04-06 05:25:44\", updated_at: \"2019-04-06 09:23:42\", dhcp_id: 1, tftp_id: 1, gateway: \"192.168.100.1\", dns_primary: \"192.168.100.1\", dns_secondary: \"\", from: \"\", to: \"\", dns_id: 1, boot_mode: \"DHCP\", ipam: \"DHCP\", discovery_id: 1, type: \"Subnet::Ipv4\", description: \"\", mtu: 1500, template_id: 1, httpboot_id: nil>>, content_source=nil>'"], "MediumProviders::Default"=>["Operating system was not set for host '#<struct token=nil, provision_interface=#<struct subnet=#<Subnet::Ipv4 id: 2, network: \"192.168.100.0\", mask: \"255.255.255.0\", priority: nil, name: \"foreman\", vlanid: nil, created_at: \"2019-04-06 05:25:44\", updated_at: \"2019-04-06 09:23:42\", dhcp_id: 1, tftp_id: 1, gateway: \"192.168.100.1\", dns_primary: \"192.168.100.1\", dns_secondary: \"\", from: \"\", to: \"\", dns_id: 1, boot_mode: \"DHCP\", ipam: \"DHCP\", discovery_id: 1, type: \"Subnet::Ipv4\", description: \"\", mtu: 1500, template_id: 1, httpboot_id: nil>>, content_source=nil>'", " medium was not set for host '#<struct token=nil, provision_interface=#<struct subnet=#<Subnet::Ipv4 id: 2, network: \"192.168.100.0\", mask: \"255.255.255.0\", priority: nil, name: \"foreman\", vlanid: nil, created_at: \"2019-04-06 05:25:44\", updated_at: \"2019-04-06 09:23:42\", dhcp_id: 1, tftp_id: 1, gateway: \"192.168.100.1\", dns_primary: \"192.168.100.1\", dns_secondary: \"\", from: \"\", to: \"\", dns_id: 1, boot_mode: \"DHCP\", ipam: \"DHCP\", discovery_id: 1, type: \"Subnet::Ipv4\", description: \"\", mtu: 1500, template_id: 1, httpboot_id: nil>>, content_source=nil>'", "Invalid medium '' for ''", "Invalid architecture '' for ''"]} 2019-04-10T09:32:07 [I|blo|8b23e43e] Unattended render of 'Boot disk iPXE - generic host' = '2c451e42546fe878162fcd544dfd8754cb9fe2b75ce8aa8faf9711d2a077c22d' #!ipxe # Example foreman_bootdisk generic host template # # This template is generic, but it will chainload to Foreman so expects the # host to be registered already.
VERIFIED Version tested: Satellite 6.5 snap 25 # rpm -qa | grep bootdisk tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-5.el7sat.noarch tfm-rubygem-foreman_bootdisk-14.0.0.2-1.el7sat.noarch
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2019:1222