Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-22184

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

XMLWordPrintable

    • Sprint 127, Sprint 128
    • Moderate
    • Yes

      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),
      -------------

          There are no Sub-Tasks for this issue.

              iballou@redhat.com Ian Ballou
              jira-bugzilla-migration RH Bugzilla Integration
              David Moore David Moore
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: