Bug 1025388 - unparsable JSON is returned when plugin fails to create resource
unparsable JSON is returned when plugin fails to create resource
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: REST (Show other bugs)
JON 3.2
Unspecified Unspecified
unspecified Severity high
: GA
: JON 3.2.0
Assigned To: Heiko W. Rupp
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-31 11:11 EDT by Libor Zoubek
Modified: 2015-11-01 19:43 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-02 15:33:20 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Libor Zoubek 2013-10-31 11:11:06 EDT
Description of problem:

If creating a new resource using REST API REST api is waiting for resource to get created by agent (or it redirects client, to poll for result). If it succeeds


Version-Release number of selected component (if applicable):
JON 3.2.ER4

How reproducible: always


Steps to Reproduce:
1. have AS7 Standalone in inventory
2. run sample https://github.com/rhq-project/samples/blob/master/rest-api/python/create_as7_deployment.py twice

Actual results:

on the 2nd run you get non-JSON response, but server resports content-type as application/json (sample will not print it, though)

Expected results:

server must return valid response with error message in JSON format. I'd suggest changing endpoint GET /resource/creationStatus/{id} to include status information in every case.

Additional info:
Comment 1 Thomas Heute 2013-11-01 10:12:05 EDT
Marked as blocker, as the suggestion is to change the endpoint (API) this would not be welcomed in a fix post-GA. (Solution could be elsewhere though)
Comment 3 Heiko W. Rupp 2013-11-01 11:20:09 EDT
Ok, nm the output

There are two issues here:

1) the endpoint indeed did not wrap the response correctly
2) the script does not honor http response codes and would have seen that this is an error by the 500 return code 


1) is fixed in

master 64286484fc
release branch 6bb68f530d
Comment 4 Libor Zoubek 2013-11-04 07:21:23 EST
2) should be fixed in https://github.com/rhq-project/samples/pull/11

I have to apologize for not checking response code. I didn't check it because I consider state "cannot create resource" not as a server error (denoted by status code 500) but as possibly expected state.

Now, after reading RFC, there's probably not a better response code for this situation.
Comment 5 Simeon Pinder 2013-12-13 11:13:48 EST
Moving this to ON_QA, as discussed in triage call (myarboro,loleary,spinder). This is already in the GA tag but somehow we didn't set this to ON_QA.
Comment 6 Libor Zoubek 2013-12-17 04:22:28 EST
verified on 3.2.0.GA

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