Bug 1698193

Summary: Missing resource error message poorly worded
Product: Red Hat CloudForms Management Engine Reporter: Joe Vlcek <jvlcek>
Component: APIAssignee: Joe Vlcek <jvlcek>
Status: CLOSED ERRATA QA Contact: Md Nadeem <mnadeem>
Severity: low Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: low    
Version: unspecifiedCC: mnadeem, obarenbo, sbulage, simaishi
Target Milestone: GA   
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-12 13:36:21 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 Joe Vlcek 2019-04-09 19:03:38 UTC
Description of problem:
When a required field is omitted from an API request the working of the
resulting error message is poorly structured.

How Reproducible:

Always

Steps to Reproduce:

Issue an API POST without specifying a required resource field.
e.g.:
Issue the following API POST without specifying the required "mode" or "description" resource field:

curl -k --user admin:<pw> -i -X  POST -H "Content-Type: application/json" -H "Accept: application/json" -d ' { "resources": [{ "description": "none" }] }' https://<my-appliance>/api/alert_definition_profiles

Actual results:

Note the poor wording of the resulting error message:
{"error":{"kind":"bad_request","message":"Resource mode needs be specified for creating a new alert_definition_profiles","klass":"Api::BadRequestError"}}


Expected results:

A properly worded error message.

e.g.:

"Resource mode must be specified when creating a new alert_definition_profiles"

Comment 3 CFME Bot 2019-04-09 21:27:29 UTC
New commit detected on ManageIQ/manageiq-api/master:

https://github.com/ManageIQ/manageiq-api/commit/d52bbb29d583e9befc3e1c82ef827ce6967fe690
commit d52bbb29d583e9befc3e1c82ef827ce6967fe690
Author:     Joe VLcek <jvlcek>
AuthorDate: Tue Apr  9 16:43:58 2019 -0400
Commit:     Joe VLcek <jvlcek>
CommitDate: Tue Apr  9 16:43:58 2019 -0400

    Fix poor wording on missing resource error message.

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1698193

 app/controllers/api/base_controller/parser.rb | 2 +-
 spec/requests/policies_spec.rb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comment 6 errata-xmlrpc 2019-12-12 13:36:21 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/RHBA-2019:4199