Bug 2228820 - ISE when incorrect content-type used for organization creation through API
Summary: ISE when incorrect content-type used for organization creation through API
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Organizations and Locations
Version: 6.14.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-03 10:53 UTC by Lukáš Hellebrandt
Modified: 2023-08-03 12:42 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
foreman-tail.txt (12.46 KB, text/plain)
2023-08-03 10:55 UTC, Lukáš Hellebrandt
no flags Details

Description Lukáš Hellebrandt 2023-08-03 10:53:49 UTC
Description of problem:
When I use an API call to create an organization and I specify an existing, but incorrect content-type (or I don't specify any at all), the call returns 500 Internal Server Error.

Version-Release number of selected component (if applicable):
Reproduced on Sat 6.14 snap 9.0, 10.0, but not 8.0.

How reproducible:
Deterministic

Steps to Reproduce:
1. # curl -uadmin:changeme -H 'Content-Type: application/json' -X POST https://$(hostname)/api/organizations -d '{"organization": {"name": "test1"}}'
{"select_all_types":[],"description":null,"created_at":"2023-08-03 10:51:04 UTC"
[...]
2. # curl -uadmin:changeme -H 'Content-Type: text/html' -X POST https://$(hostname)/api/organizations -d '{"organization": {"name": "test2"}}'
{
  "error": {"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."}
}
3. # curl -uadmin:changeme -H 'Content-Type: text/html' -X POST https://$(hostname)/api/locations -d '{"location": {"name": "test3"}}'
{
  "error": {"message":"Media type in 'Content-Type: text/html' is unsupported in API v2 for POST and PUT requests. Please use 'Content-Type: application/json'."}
}

Actual results:
For correct content-type, the organization is created. For incorrect type on a location endpoint, a location is not created and the error is handled correctly. For incorrect type on an organization endpoint, ISE happens.

Expected results:
The same behavior as for locaiton.

Additional info:
Traceback attached.

Comment 1 Lukáš Hellebrandt 2023-08-03 10:55:57 UTC
Created attachment 1981466 [details]
foreman-tail.txt

The error is:

Backtrace for 'Action failed' error (NoMethodError): undefined method `[]=' for nil:NilClass

Comment 2 Lukáš Hellebrandt 2023-08-03 11:15:34 UTC
Also reproduced on Sat 6.13.0


Note You need to log in before you can comment on or make changes to this bug.