Bug 1025388

Summary: unparsable JSON is returned when plugin fails to create resource
Product: [JBoss] JBoss Operations Network Reporter: Libor Zoubek <lzoubek>
Component: RESTAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: JON 3.2CC: lzoubek, myarboro, theute
Target Milestone: GA   
Target Release: JON 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-02 20:33:20 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 Libor Zoubek 2013-10-31 15:11:06 UTC
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 14:12:05 UTC
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 15:20:09 UTC
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 12:21:23 UTC
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 16:13:48 UTC
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 09:22:28 UTC
verified on 3.2.0.GA