Bug 1920819

Summary: 'Applied Errata' report fails with error 'no implicit conversion of nil into Array'
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: ReportingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: dmatoule, mhulan, oezr, oprazak, zhunting
Target Milestone: 6.9.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.18.1.7-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1936462 (view as bug list) Environment:
Last Closed: 2021-04-21 13:10:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1936462    

Description Ranjan Kumar 2021-01-27 05:35:22 UTC
Description of problem: Applied Errata report fails, here is error trace

2021-01-27T00:21:47 [I|app|1c24b06d] Started POST "/templates/report_templates/153-Host%20-%20Applied%20Errata/schedule_report" for 127.0.0.1 at 2021-01-27 00:21:47 -0500
2021-01-27T00:21:47 [I|app|1c24b06d] Processing by ReportTemplatesController#schedule_report as HTML
2021-01-27T00:21:47 [I|app|1c24b06d]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"1epfYMPtPmfsPXrp8fqO8DcVXZsRgDWOQnKZh9QzDlfrlGg/4TkHBSstujDjRe12ITB4s59mpVU3Byo7bQm+JQ==", "report_template_report"=>"[FILTERED]", "commit"=>"Submit", "id"=>"153-Host - Applied Errata"}
2021-01-27T00:21:48 [I|app|1c24b06d] Enqueued TemplateRenderJob (Job ID: 5c8cf240-119e-448b-a23e-66a985ca719e) to Dynflow(default) with arguments: {"template_id"=>"153-Host - Applied Errata", "gzip"=>false, "send_mail"=>false, "mail_to"=>"root", "format"=>"csv", "input_values"=>{"55"=>{"value"=>"all"}, "56"=>{"value"=>"no"}, "57"=>{"value"=>"success"}, "58"=>{"value"=>"2020-09-08 10:51:00"}, "59"=>{"value"=>"2021-01-27 10:51:00"}}}, {:user_id=>4}
2021-01-27T00:21:48 [I|app|1c24b06d] Redirected to https://vm255-31.gsslab.pnq2.redhat.com/templates/report_templates/153-Host%20-%20Applied%20Errata/report_data?job_id=5c8cf240-119e-448b-a23e-66a985ca719e
2021-01-27T00:21:48 [I|app|1c24b06d] Completed 302 Found in 142ms (ActiveRecord: 19.5ms | Allocations: 24864)
2021-01-27T00:21:48 [I|app|b3258986] Started GET "/templates/report_templates/153-Host%20-%20Applied%20Errata/report_data?job_id=5c8cf240-119e-448b-a23e-66a985ca719e" for 127.0.0.1 at 2021-01-27 00:21:48 -0500
2021-01-27T00:21:48 [I|app|b3258986] Processing by ReportTemplatesController#report_data as HTML
2021-01-27T00:21:48 [I|app|b3258986]   Parameters: {"job_id"=>"5c8cf240-119e-448b-a23e-66a985ca719e", "id"=>"153-Host - Applied Errata"}
2021-01-27T00:21:48 [I|app|1c24b06d] Performing TemplateRenderJob (Job ID: 5c8cf240-119e-448b-a23e-66a985ca719e) from Dynflow(default) enqueued at 2021-01-27T05:21:47Z with arguments: {"template_id"=>"153-Host - Applied Errata", "gzip"=>false, "send_mail"=>false, "mail_to"=>"root", "format"=>"csv", "input_values"=>{"55"=>{"value"=>"all"}, "56"=>{"value"=>"no"}, "57"=>{"value"=>"success"}, "58"=>{"value"=>"2020-09-08 10:51:00"}, "59"=>{"value"=>"2021-01-27 10:51:00"}}}, {:user_id=>4}
2021-01-27T00:21:48 [I|app|b3258986]   Rendering report_templates/report_data.html.erb within layouts/application
2021-01-27T00:21:48 [I|app|b3258986]   Rendered report_templates/report_data.html.erb within layouts/application (Duration: 10.8ms | Allocations: 6824)
2021-01-27T00:21:48 [I|app|b3258986]   Rendered layouts/_application_content.html.erb (Duration: 7.2ms | Allocations: 6992)
2021-01-27T00:21:48 [I|app|b3258986]   Rendering layouts/base.html.erb
2021-01-27T00:21:48 [I|app|b3258986]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-7.0.1.4/app/views/foreman_theme_satellite/_theme_client_side_branding.js.erb (Duration: 7.2ms | Allocations: 6852)
2021-01-27T00:21:48 [I|app|b3258986]   Rendered layouts/base.html.erb (Duration: 80.2ms | Allocations: 39163)
2021-01-27T00:21:48 [I|app|b3258986] Completed 200 OK in 136ms (Views: 105.3ms | ActiveRecord: 6.3ms | Allocations: 64679)
2021-01-27T00:21:48 [E|app|1c24b06d] Error performing TemplateRenderJob (Job ID: 5c8cf240-119e-448b-a23e-66a985ca719e) from Dynflow(default) in 424.03ms: TypeError (no implicit conversion of nil into Array):
 1c24b06d | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.3/app/lib/katello/concerns/base_template_scope_extensions.rb:127:in `&'
 1c24b06d | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.3/app/lib/katello/concerns/base_template_scope_extensions.rb:127:in `block in load_errata_applications'
 1c24b06d | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/batches/batch_enumerator.rb:64:in `block in each'
 1c24b06d | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/batches.rb:238:in `block in in_batches'
 1c24b06d | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/batches.rb:222:in `loop'
 1c24b06d | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/batches.rb:222:in `in_batches'


Version-Release number of selected component (if applicable):


How reproducible: Always


Additional info:
[root@vm255-31 ~]# rpm -qa | grep satellite
satellite-6.9.0-0.3.beta.el7sat.noarch

Comment 2 Marek Hulan 2021-02-02 10:08:43 UTC
This is a regression caused by https://projects.theforeman.org/issues/30626, in case no host_filter is specified (nil), the `array & nil` fails. The fix should be simple. Ondrej, could you please take a look?

Comment 6 Bryan Kearney 2021-02-23 16:06:31 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/31748 has been resolved.

Comment 8 Lukáš Hellebrandt 2021-03-08 15:11:59 UTC
Fix for bug 1737536 which caused this regression has been reverted in 6.9 and is now targetted to 6.10.
Verified that with Sat 6.9, snap 16, there is no hosts filter in the Applied Errata report template and it can be generated correctly.

Comment 11 errata-xmlrpc 2021-04-21 13:10:30 UTC
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 (Moderate: Satellite 6.9 Release), 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-2021:1313