Bug #36182
closedundefined method `[]' for nil:NilClass" or undefined method `last' for nil:NilClass" when generating Host - applied errata report
Description
Clone from https://bugzilla.redhat.com/show_bug.cgi?id=2176368
Description of problem:
Getting one of the following errors while generating the Host - Applied Errata report.
- undefined method `[]' for nil:NilClass"
- undefined method `last' for nil:NilClass"
The first error is caused by task input returns nil because the code is fetching it the wrong way.
The second error will happen if an erratum that user tried to apply to the hosts doesn't exist in the database or is invalid. E.g. typo error.
Steps to reproduce:
1. In the "Run Job" page, use Katello SSH to apply errata to one or more hosts. In the errata field, simply enter any invalid errata.
2. Wait for the job to finish.
3. Generate the Host - Applied Errata report.
Actual results:
undefined method `last' for nil:NilClass"
Expected results:
Report can be generated successfully.
Additional info:
Updated by The Foreman Bot over 1 year ago
- Status changed from New to Ready For Testing
- Assignee set to Hao Yu
- Pull request https://github.com/Katello/katello/pull/10482 added
Updated by Jeremy Lenz over 1 year ago
- Target version set to Katello 4.8.0
- Triaged changed from No to Yes
Updated by The Foreman Bot over 1 year ago
- Fixed in Releases Katello 4.9.0 added
Updated by Hao Yu over 1 year ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|4b34cadae167b56cd2934607511900901a80bcae.