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.

Bug 1879020

Summary: HTTP 500 returned if trying to download a subnet bootdisk for non-existent subnet id
Product: Red Hat Satellite Reporter: Roman Plevka <rplevka>
Component: Bootdisk PluginAssignee: Dominik Matoulek <dmatoule>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: low Docs Contact:
Priority: low    
Version: 6.8.0CC: dmatoule, ehelms, lzap
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:09:27 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:

Description Roman Plevka 2020-09-15 08:41:04 UTC
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

Comment 2 Dominik Matoulek 2021-03-23 15:04:03 UTC
Created redmine issue https://projects.theforeman.org/issues/32179 from this bug

Comment 3 Bryan Kearney 2021-03-23 16:04:03 UTC
Upstream bug assigned to dmatoule

Comment 4 Bryan Kearney 2021-03-23 16:04:05 UTC
Upstream bug assigned to dmatoule

Comment 5 Bryan Kearney 2021-03-29 21:00:26 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32179 has been resolved.

Comment 6 Roman Plevka 2021-07-02 06:37:12 UTC
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'
```

Comment 9 errata-xmlrpc 2021-11-16 14:09:27 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.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