Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
The request returns 500 instead of 404 if a non-existent subnet id is provided.
# hammer bootdisk subnet --subnet-id 999
Failed to download subnet disk image:
500 Internal Server Error
2020-09-15T04:35:27 [I|app|b2d506db] Started GET "/bootdisk/api/subnets/2" for 2620:52:0:10d8:7ae7:d1ff:fe21:6e78 at 2020-09-15 04:35:27 -0400
2020-09-15T04:35:27 [I|app|b2d506db] Processing by ForemanBootdisk::Api::V2::SubnetDisksController#subnet as JSON
2020-09-15T04:35:27 [I|app|b2d506db] Parameters: {"apiv"=>"v2", "id"=>"2", "subnet_disk"=>{}}
2020-09-15T04:35:28 [D|app|b2d506db] Authenticated user admin against INTERNAL authentication source
2020-09-15T04:35:28 [D|app|b2d506db] Post-login processing for admin
2020-09-15T04:35:28 [I|app|b2d506db] Authorized user admin(Admin User)
2020-09-15T04:35:28 [D|app|b2d506db] Post-login processing for admin
2020-09-15T04:35:28 [D|tax|b2d506db] Current location set to none
2020-09-15T04:35:28 [D|tax|b2d506db] Current organization set to none
2020-09-15T04:35:28 [D|tax|b2d506db] Current location set to none
2020-09-15T04:35:28 [D|tax|b2d506db] Current organization set to none
2020-09-15T04:35:28 [I|app|b2d506db] Couldn't find Subnet with 'id'=2 (ActiveRecord::RecordNotFound)
2020-09-15T04:35:28 [I|app|b2d506db] Completed 500 Internal Server Error in 121ms (ActiveRecord: 42.4ms | Allocations: 10166)
2020-09-15T04:35:28 [F|app|b2d506db]
NameError (Could not find resource class for resource subnet_disk):
Version-Release number of selected component (if applicable):
6.8.0-14
How reproducible:
using hammer and api
Steps to Reproduce:
1. try to download a subnet disk image for a non-existent subnet, e.g. # hammer bootdisk subnet --subnet-id 9999
Actual results:
HTTP 500 returned
Expected results:
HTTP 404 returned with a proper error message
Verified
on sat6.10.0-7.0
the error is now handled properly:
```
# hammer bootdisk subnet --subnet-id 999
Failed to download subnet disk image:
Subnet not found by id '999'
```
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.10 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:4702
Description of problem: The request returns 500 instead of 404 if a non-existent subnet id is provided. # hammer bootdisk subnet --subnet-id 999 Failed to download subnet disk image: 500 Internal Server Error 2020-09-15T04:35:27 [I|app|b2d506db] Started GET "/bootdisk/api/subnets/2" for 2620:52:0:10d8:7ae7:d1ff:fe21:6e78 at 2020-09-15 04:35:27 -0400 2020-09-15T04:35:27 [I|app|b2d506db] Processing by ForemanBootdisk::Api::V2::SubnetDisksController#subnet as JSON 2020-09-15T04:35:27 [I|app|b2d506db] Parameters: {"apiv"=>"v2", "id"=>"2", "subnet_disk"=>{}} 2020-09-15T04:35:28 [D|app|b2d506db] Authenticated user admin against INTERNAL authentication source 2020-09-15T04:35:28 [D|app|b2d506db] Post-login processing for admin 2020-09-15T04:35:28 [I|app|b2d506db] Authorized user admin(Admin User) 2020-09-15T04:35:28 [D|app|b2d506db] Post-login processing for admin 2020-09-15T04:35:28 [D|tax|b2d506db] Current location set to none 2020-09-15T04:35:28 [D|tax|b2d506db] Current organization set to none 2020-09-15T04:35:28 [D|tax|b2d506db] Current location set to none 2020-09-15T04:35:28 [D|tax|b2d506db] Current organization set to none 2020-09-15T04:35:28 [I|app|b2d506db] Couldn't find Subnet with 'id'=2 (ActiveRecord::RecordNotFound) 2020-09-15T04:35:28 [I|app|b2d506db] Completed 500 Internal Server Error in 121ms (ActiveRecord: 42.4ms | Allocations: 10166) 2020-09-15T04:35:28 [F|app|b2d506db] NameError (Could not find resource class for resource subnet_disk): Version-Release number of selected component (if applicable): 6.8.0-14 How reproducible: using hammer and api Steps to Reproduce: 1. try to download a subnet disk image for a non-existent subnet, e.g. # hammer bootdisk subnet --subnet-id 9999 Actual results: HTTP 500 returned Expected results: HTTP 404 returned with a proper error message