Bug 859936 - Consumer update API call cannot consume JSON produced by Consumer get API call
Consumer update API call cannot consume JSON produced by Consumer get API call
Status: CLOSED NOTABUG
Product: Candlepin
Classification: Community
Component: candlepin (Show other bugs)
0.9
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Jesus M. Rodriguez
Eric Sammons
:
Depends On:
Blocks: 771481 sam13-tracker
  Show dependency treegraph
 
Reported: 2012-09-24 08:36 EDT by Dmitri Dolguikh
Modified: 2015-05-14 10:53 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-19 14:46:14 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 Dmitri Dolguikh 2012-09-24 08:36:00 EDT
Consumer UPDATE chokes on json produced by Consumer GET.

SHould be reproducible via curl:

curl -u admin:admin http://localhost:8080/candlepin/consumers/<uuid>

curl -u admin:admin -H "Content-type: application/json" -X PUT <json from the previous step> http://localhost:8080/candlepin/consumers/<uuid>
Comment 1 Jesus M. Rodriguez 2012-12-19 14:41:36 EST
the above PUT command is incorrect, it requires --data BEFORE the <json from the previous step>. Without --data, I get the following error:

{"displayMessage":"Runtime Error java.io.EOFException: No content to map to Object due to end of input at org.codehaus.jackson.map.ObjectMapper._initForReading:2,766"}

This is expected. If you want to PUT or POST please use --data from curl.
Comment 2 Jesus M. Rodriguez 2012-12-19 14:45:42 EST
Using --data, the following scenarios worked:

GET:
curl -u admin:admin http://localhost:8080/candlepin/consumers/<uuid> > consumer.json
curl -k -u admin:admin https://localhost:8443/candlepin/consumers/<uuid> > consumer.json

PUT:
curl -k -u admin:admin -H "Content-type: application/json" -X PUT --data @consumer.json https://localhost:8443/candlepin/consumers/<uuid>

curl -u admin:admin -H "Content-type: application/json" -X PUT --data @consumer.json http://localhost:8080/candlepin/consumers/<uuid>

The following requires single quotes (') around the JSON:
curl -k -u admin:admin -H "Content-type: application/json" -X PUT --data 'PASTED JSON DIRECTLY INTO TERMINAL' https://localhost:8443/candlepin/consumers/<uuid>

curl -u admin:admin -H "Content-type: application/json" -X PUT --data 'PASTED JSON DIRECTLY INTO TERMINAL' http://localhost:8080/candlepin/consumers/<uuid>

None of the above produced an error. Then I MODIFIED the consumer.json to change the name and autoheal values BEFORE executing the PUT. After modifying the input the PUT calls resulted in updated consumer records in the database, as expected.
Comment 3 Jesus M. Rodriguez 2012-12-19 14:46:14 EST
I'm going to close this bug as NOTABUG because it works as of candlepin 0.7.23

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