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
Created redmine issue https://projects.theforeman.org/issues/32179 from this bug
Upstream bug assigned to dmatoule
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32179 has been resolved.
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