Bug 1860351

Summary: 'Host - compare content hosts packages' report fails with error 'undefined method '#first' for NilClass'
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: ReportingAssignee: Shira Maximov <mshira>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: high    
Version: 6.8.0CC: jyejare, mhulan, mshira, oprazak, tbrisker
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: foreman-2.1.2.3-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 13:04:32 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:
Attachments:
Description Flags
Screen 1
none
Screen 2 none

Description Ranjan Kumar 2020-07-24 11:02:34 UTC
Created attachment 1702332 [details]
Screen 1

Description of problem: Generating 'Host - compare content hosts packages' using wrong host fails with error "undefined method '#first' for NilClass::Jail (NilClass)" in WebUI

Hammer also fails with different error
 #hammer  report-template generate --inputs "Host 1 = host1.example.local,Host 2 = wrong.host.local"  --name 'Host - compare content hosts packages'
Unrecognized status code :internal_error

Production log:
2020-07-24T16:25:53 [I|app|16e87c8c] Started POST "/api/report_templates/243/generate" for 127.0.0.1 at 2020-07-24 16:25:53 +0530
2020-07-24T16:25:53 [I|app|16e87c8c] Processing by Api::V2::ReportTemplatesController#generate as JSON
2020-07-24T16:25:53 [I|app|16e87c8c]   Parameters: {"input_values"=>"[FILTERED]", "apiv"=>"v2", "id"=>"243", "report_template"=>{}}
2020-07-24T16:25:53 [I|app|16e87c8c] Authorized user admin(Admin User)
2020-07-24T16:25:53 [W|app|16e87c8c] Scoped order is ignored, it's forced to be batch order.
2020-07-24T16:25:53 [W|app|16e87c8c] Scoped order is ignored, it's forced to be batch order.
2020-07-24T16:25:54 [W|app|16e87c8c] Action failed
2020-07-24T16:25:54 [I|app|16e87c8c]   Rendering api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout
2020-07-24T16:25:54 [I|app|16e87c8c]   Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (Duration: 14.6ms | Allocations: 6560)
2020-07-24T16:25:54 [I|app|16e87c8c] Completed 500 Internal Server Error in 434ms (Views: 21.5ms | ActiveRecord: 69.9ms | Allocations: 198510)


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


How reproducible: Always

Actual results: raise and error


Expected results: Should fail with valid error message


Additional info:
[root@dhcp130-171 foreman]# rpm -qa satellite
satellite-6.8.0-0.7.beta.el7sat.noarch
[root@dhcp130-171 foreman]# rpm -qa foreman
foreman-2.1.0.1-1.el7sat.noarch
[root@dhcp130-171 foreman]# rpm -qa katello
katello-3.16.0-0.4.rc4.el7sat.noarch

Comment 1 Ranjan Kumar 2020-07-24 11:03:20 UTC
Created attachment 1702333 [details]
Screen 2

Comment 2 Brad Buckingham 2020-07-27 21:04:15 UTC
Hi Ranjan,

Thanks for the bugzilla report.

Is this a duplicate of bug 1860430?

Would it be possible to provide the exact reproducer steps in each bugzilla so that we can see what is different?

Thanks!

Comment 3 Ranjan Kumar 2020-07-28 08:43:24 UTC
@Brad

Yes, Its different from BZ#1860430

Easy to reproduce, Just use a hostname that do not exist in satellite. For eg  host_not_exit.local doesn't exist in satellite. This will raise an error. But it should return a valid error message like "404 Host host_not_exit.local not found"

hammer  report-template generate --inputs "Host 1 = host1.example.local,Host 2 = host_not_exit.local"  --name 'Host - compare content hosts packages'
Unrecognized status code :internal_error

Comment 4 Tomer Brisker 2020-08-04 06:44:25 UTC
Created redmine issue https://projects.theforeman.org/issues/30556 from this bug

Comment 5 Bryan Kearney 2020-08-12 12:04:27 UTC
Upstream bug assigned to mshira

Comment 6 Bryan Kearney 2020-08-12 12:04:31 UTC
Upstream bug assigned to mshira

Comment 8 Bryan Kearney 2020-08-25 16:04:28 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30556 has been resolved.

Comment 12 Lukáš Hellebrandt 2020-09-18 10:11:13 UTC
This is *almost* fixed right, except when I enter the same (valid) hosts in both host fields, I get a misleading error of "At least one of the hosts couldn't be found."

Shira, do you prefer me to fail this BZ or validate it and file a new one about this minor issue?

Comment 13 Shira Maximov 2020-09-21 09:03:28 UTC
Lukas, I would prefer that you validate this BZ  and file a new one, thanks!

Comment 14 Lukáš Hellebrandt 2020-09-21 09:49:32 UTC
Verified as per comment 12 and comment 13. Hosts can now be specified and the results are correct.

Comment 17 errata-xmlrpc 2020-10-27 13:04:32 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 (Important: Satellite 6.8 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-2020:4366