Bug 859936 - Consumer update API call cannot consume JSON produced by Consumer get API call
Summary: Consumer update API call cannot consume JSON produced by Consumer get API call
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.9
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Jesus M. Rodriguez
QA Contact: Eric Sammons
URL:
Whiteboard:
Depends On:
Blocks: 771481 sam13-tracker
TreeView+ depends on / blocked
 
Reported: 2012-09-24 12:36 UTC by Dmitri Dolguikh
Modified: 2015-05-14 14:53 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-12-19 19:46:14 UTC
Embargoed:


Attachments (Terms of Use)

Description Dmitri Dolguikh 2012-09-24 12:36:00 UTC
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 19:41:36 UTC
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 19:45:42 UTC
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 19:46:14 UTC
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.