| Summary: | [REST API] 409 on key creation with duplicate content should set error on :content field | ||
|---|---|---|---|
| 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: | bmeng, 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:23 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
Clayton Coleman
2012-02-20 21:54:55 UTC
The problem is more subtle. The site needs to know specifically (programmatically) when the key is in conflict (when the key is 'domain') vs. when the content is in conflict. So the error message returned by the server specifically for the 'key already exists' and 'content already exists' error states needs to contain two separate "code" attributes that allows the site to programmatically determine the difference. Isolated when debugging bug 795538 That previous comment should read "when the key is 'default' the site will do something different if the key is in conflict". Checked on devenv_1632, via web site. Improper error message "You have already created a key with that name" displays when adding ssh key with same contents and different key name. Verified this bug with devenv_1642, and PASS.
exit-code, field and text elements is filled in the output of REST API.
$ curl -k -X POST -H 'Accept: application/xml' -H 'Content-type: application/json' -d '{'\''name'\'':'\''default'\'','\''type'\'':'\''ssh-rsa'\'','\''content'\'':blablablabla}' --user jialiu:xx https://ec2-50-16-44-115.compute-1.amazonaws.com/broker/rest/user/keys
<?xml version="1.0" encoding="UTF-8"?>
<response>
<type nil="true"></type>
<messages>
<message>
<exit-code>120</exit-code>
<field>name</field>
<text>SSH key with name default already exists. Use a different name or delete conflicting key and retry.</text>
<severity>error</severity>
</message>
</messages>
<status>conflict</status>
<version>1.0</version>
<data nil="true"></data>
</response>
$ curl -k -X POST -H 'Accept: application/xml' -H 'Content-type: application/json' -d '{'\''name'\'':'\''mykey'\'','\''type'\'':'\''ssh-rsa'\'','\''content'\'':blablablabla}' --user jialiu:xx https://ec2-50-16-44-115.compute-1.amazonaws.com/broker/rest/user/keys
<?xml version="1.0" encoding="UTF-8"?>
<response>
<type nil="true"></type>
<messages>
<message>
<exit-code>121</exit-code>
<field>content</field>
<text>Given public key is already in use. Use different key or delete conflicting key and retry.</text>
<severity>error</severity>
</message>
</messages>
<status>conflict</status>
<version>1.0</version>
<data nil="true"></data>
</response>
|