Project

General

Profile

Actions

Bug #37016

closed

Getting "undefined method '#name' for NilClass::Jail (NilClass) (Safemode::NoMethodError)" error generating subscription report

Added by Hao Yu 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Reporting
Target version:
Fixed in Releases:
Found in Releases:

Description

Clone from https://bugzilla.redhat.com/show_bug.cgi?id=2256411

Description of problem:
Getting the following error in production.log when generating report for "Subscription - Entitlement Report".

-----------------
2024-01-02T05:06:18 [E|app|51ccadd6] Error performing TemplateRenderJob (Job ID: 3d7cbab7-b3b5-44f7-911f-2eb9bfd454f5) from Dynflow(default) in 467.55ms: Safemode::NoMethodError (undefined method '#name' for NilClass::Jail (NilClass)):
51ccadd6 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode/jail.rb:22:in `method_missing'
51ccadd6 | Subscription - Entitlement Report:63:in `block (2 levels) in initialize'
51ccadd6 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode/jail.rb:31:in `each'
51ccadd6 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode/jail.rb:31:in `method_missing'
51ccadd6 | Subscription - Entitlement Report:62:in `block in initialize'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches/batch_enumerator.rb:40:in `block (2 levels) in each_record'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches/batch_enumerator.rb:40:in `each'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches/batch_enumerator.rb:40:in `block in each_record'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches.rb:245:in `block in in_batches'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches.rb:229:in `loop'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches.rb:229:in `in_batches'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches/batch_enumerator.rb:39:in `each'
51ccadd6 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/batches/batch_enumerator.rb:39:in `each_record'
51ccadd6 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode/jail.rb:31:in `method_missing'
51ccadd6 | Subscription - Entitlement Report:59:in `initialize'
51ccadd6 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode.rb:52:in `eval'
51ccadd6 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode.rb:52:in `eval'
51ccadd6 | /usr/share/foreman/app/services/foreman/renderer/safe_mode_renderer.rb:7:in `render'
51ccadd6 | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in `render'
51ccadd6 | /usr/share/foreman/app/services/foreman/renderer.rb:46:in `render'
51ccadd6 | /usr/share/foreman/app/models/template.rb:172:in `render'
51ccadd6 | /usr/share/foreman/app/models/report_composer.rb:241:in `render'
51ccadd6 | /usr/share/foreman/app/jobs/template_render_job.rb:12:in `block in perform'
51ccadd6 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
51ccadd6 | /usr/share/foreman/app/jobs/template_render_job.rb:9:in `perform'
-----------------

How reproducible:
Easy

Steps to Reproduce:
1. Disable SCA in the Satellite
2. Configure virt-who and run it so that virt-who* hypervisor hosts will be created in Satellite.
3. Attach VDC subscription to the virt-who* hypervisor hosts.
4. Generate the "Subscription - Entitlement Report".

Actual results:
undefined method '#name' for NilClass::Jail (NilClass) (Safemode::NoMethodError)

Expected results:
Report can be generated successfully.

Additional info:
The error is caused by the following 2 lines in the "Subscription - Entitlement Report" template because virt-who* hypervisor hosts don't have any LCE or Content View.

-------------
<%- report_row(
'Host Name': host.name,
'Organization': host.organization,
'Lifecycle Environment': host.single_lifecycle_environment.name, <===========
'Content View': host.single_content_view.name, <==============
'Host Collections': host_collections_names(host),
-------------

Actions #1

Updated by William Clark 4 months ago

  • Target version set to Katello 4.11.1
  • Triaged changed from No to Yes
Actions #2

Updated by Ian Ballou 3 months ago

  • Project changed from Katello to Foreman
  • Category changed from Reporting to Reporting
  • Assignee set to Ian Ballou
  • Target version changed from Katello 4.11.1 to 3.9.2
Actions #3

Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9984 added
Actions #4

Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 3.10.0 added
Actions #5

Updated by Chris Roberts 3 months ago

  • Status changed from Ready For Testing to Closed
Actions #6

Updated by The Foreman Bot 3 months ago

  • Pull request https://github.com/theforeman/foreman/pull/10017 added
Actions #7

Updated by The Foreman Bot 3 months ago

  • Pull request https://github.com/theforeman/foreman/pull/10023 added
Actions #8

Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 3.9.2 added
Actions

Also available in: Atom PDF