| Summary: | [REST API] Create of key not returning 'content' attribute | ||
|---|---|---|---|
| Product: | OKD | Reporter: | Clayton Coleman <ccoleman> |
| Component: | Pod | Assignee: | Lili Nader <lnader> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | libra bugs <libra-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 2.x | CC: | jialiu, mfisher, rmillner |
| Target Milestone: | --- | Keywords: | Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-03-02 21:56:18 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Verified this bug with devenv_1642, and PASS.
$ curl -k -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -d '{'\''name'\'':'\''mykey1'\'','\''type'\'':'\''ssh-rsa'\'','\''content'\'':blablablablala}' --user jialiu:214214 https://ec2-50-16-44-115.compute-1.amazonaws.com/broker/rest/user/keys
{"version":"1.0","status":"created","messages":[{"text":"Created SSH key mykey1 for user jialiu","exit_code":null,"field":null,"severity":"info"}],"type":"key","data":{"type":"ssh-rsa","content":"blablablablala","links":{"UPDATE":{"href":"/user/keys/mykey1","method":"PUT","optional_params":[],"required_params":[{"valid_options":["ssh-rsa","ssh-dss"],"type":"string","description":"Type of Key","name":"type"},{"valid_options":[],"type":"string","description":"The key portion of an rsa key (excluding ssh-rsa and comment)","name":"content"}],"rel":"Update SSH key"},"GET":{"href":"/user/keys/mykey1","method":"GET","optional_params":[],"required_params":[],"rel":"Get SSH key"},"DELETE":{"href":"/user/keys/mykey1","method":"DELETE","optional_params":[],"required_params":[],"rel":"Delete SSH key"}},"name":"mykey1"}}
|
When creating a key, the 'content' attribute is not returned by the server. Expect the content attribute to match what was sent. Ignore the 'raw_content' attribute sent by the client - it's a virtual attribute we use in the UI and isn't always going to be sent. opening connection to localhost... opened <- "POST /broker/rest/user/keys.json HTTP/1.1\r\nAccept: */*\r\nAuthorization: Basic YXBwX3Rlc3QxQHRlc3QxLmNvbTo=\r\nHost: localhost\r\nContent-Type: application/json\r\nContent-Length: 79\r\nConnection: close\r\n\r\n" <- "{\"content\":\"abc2\",\"name\":\"test2\",\"type\":\"ssh-rsa\",\"raw_content\":\"ssh-rsa abc2\"}" -> "HTTP/1.1 201 Created\r\n" -> "Date: Fri, 24 Feb 2012 18:10:55 GMT\r\n" -> "Server: Apache/2.2.15 (Red Hat)\r\n" -> "X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.4\r\n" -> "X-Runtime: 0.396798\r\n" -> "Cache-Control: no-cache\r\n" -> "X-UA-Compatible: IE=Edge\r\n" -> "Location: /broker/rest/api\r\n" -> "Status: 201\r\n" -> "Content-Type: application/json; charset=utf-8\r\n" -> "Connection: close\r\n" -> "Transfer-Encoding: chunked\r\n" -> "\r\n" -> "32f\r\n" reading 815 bytes... -> "" -> "{\"messages\":[{\"text\":\"Created SSH key test2 for user app_test1\",\"field\":null,\"severity\":\"info\",\"exit_code\":null}],\"type\":\"key\",\"version\":\"1.0\",\"data\":{\"content\":null,\"type\":\"ssh-rsa\",\"links\":{\"UPDATE\":{\"optional_params\":[],\"rel\":\"Update SSH key\",\"method\":\"PUT\",\"href\":\"/user/keys/test2\",\"required_params\":[{\"valid_options\":[\"ssh-rsa\",\"ssh-dss\"],\"description\":\"Type of Key\",\"type\":\"string\",\"name\":\"type\"},{\"valid_options\":[],\"description\":\"The key portion of an rsa key (excluding ssh-rsa and comment)\",\"type\":\"string\",\"name\":\"content\"}]},\"GET\":{\"optional_params\":[],\"rel\":\"Get SSH key\",\"method\":\"GET\",\"href\":\"/user/keys/test2\",\"required_params\":[]},\"DELETE\":{\"optional_params\":[],\"rel\":\"Delete SSH key\",\"method\":\"DELETE\",\"href\":\"/user/keys/test2\",\"required_params\":[]}},\"name\":\"test2\"},\"status\":\"created\"}" read 815 bytes reading 2 bytes... -> "" -> "\r\n" read 2 bytes -> "0\r\n" -> "\r\n" Conn close