Bug 1692753 - [API] - Wrong error message when changing the location of a compute resource to location that doesn't exists
Summary: [API] - Wrong error message when changing the location of a compute resource ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.7.0
Assignee: Shira Maximov
QA Contact: Jitendra Yejare
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-26 11:21 UTC by Vatsal Parekh
Modified: 2020-04-14 13:24 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
The description of the location_id and organization_id parameters are unclear in the ApiDoc and the error message for these parameters is incorrect. You must use these parameters to set the context scope for an API query, but not to update a location or organization of a compute resource. If you use this command to update a compute resource, an API request returns the wrong error message "Compute resource doesn't exist".
Clone Of:
Environment:
Last Closed: 2020-04-14 13:24:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 26754 Normal Closed Wrong error message when changing the location of a compute resource to location that doesn't exists 2020-04-13 17:43:25 UTC
Red Hat Product Errata RHSA-2020:1454 None None None 2020-04-14 13:24:19 UTC

Description Vatsal Parekh 2019-03-26 11:21:53 UTC
Description of problem:
After adding the a compute resource from API, and changing its location via PUT request, just navigating the organisation from UI makes Foreman crash, and also reset the ssl certs
Video link: https://drive.google.com/file/d/1rvd-aX9-D7piO3_szR0VdbASGGrHpZZ4/view?usp=sharing 
Check the video for more info

Version-Release number of selected component (if applicable):
master of kubevirt plugin

How reproducible:
Not always, but many times, was able to reproduce 5+ times

Steps to Reproduce:
1.Add a Compute resource from API
2.Change its location via a PUT call
3.Navigate through organisation in UI

Actual results:
Crashes Foreman and resets SSL Certs in Client Browser

Expected results:
Should show the Compute resource correctly without crashing

Additional info:
check the video

Comment 3 Vatsal Parekh 2019-03-26 11:25:32 UTC
Forgot to mention about the bulk of Redirects happening when going from default to any org, check the terminal in the video

Comment 5 Shira Maximov 2019-05-07 12:39:50 UTC
I wasn't able to reproduce this BZ, however, in the video attached, you sent the parameters wrongly : 

- You shouldn't location_id parameter because  Location_id and Organization_id only sets the location and organization scope ( users typically work in specific context, e.g. location Israel or Czech Republic and UI automatically filters resources based on the location, e.g. showing only vmware instance assigned to Israel if current location is Israel)
- You should send the request like that: "location_ids": [1,2]

However, 
- The apidoc is not that clear, so I will change it to:"Set the current location context for the request"
- ATM, when you try to update a location id with a location that doesn't exists, you can a wrong error message, so I will add PR to fix the error we are getting.

Comment 6 Shira Maximov 2019-05-07 12:42:07 UTC
Created redmine issue https://projects.theforeman.org/issues/26754 from this bug

Comment 8 Bryan Kearney 2019-09-10 12:03:46 UTC
Upstream bug assigned to mshira@redhat.com

Comment 9 Bryan Kearney 2019-09-10 12:03:47 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26754 has been resolved.

Comment 13 Shira Maximov 2019-09-15 09:11:28 UTC
I created a manual cherry-pick, thanks Zach.

Comment 15 Jitendra Yejare 2019-12-10 10:41:54 UTC
Verified!

@Satellite 6.5 snap 5

Steps:
-------------
1. Create a GCE CR
2. Attempt to update its location(that doesnt exists) from API PUT request


Observation:
---------------
1. The location of CR is not being updated for the location doesnt exists as expected.
2. The correct error message is being showed.
  $ curl -H "Content-Type: application/json" -k -X PUT https://sat.com/api/v2/compute_resources/1 -d '{"compute_resource":{"location_ids":[44]}}' --insecure
{
  "error": {"message":"Couldn't find Taxonomy with 'id'=[44]"}
}

3. Navigation throughout the organization and satellite is smooth form UI post this error.

Comment 18 errata-xmlrpc 2020-04-14 13:24:10 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, 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-2020:1454


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