Bug #14162
closedrgw: return suitable error message for bad request when using Admin API
0%
Description
1. use admin api to create two users, with same email address:
$ curl -s -X PUT http://ceph1:9090/admin/user?format=json&uid=testuser1&exclusive=true&display-name=testuser1&email=testuser%40gmail.com
the response: as expected.
$ curl -s -X PUT http://ceph1:9090/admin/user?format=json&uid=testuser2&exclusive=true&display-name=testuser2&email=testuser%40gmail.com
get response: {"Code":"UserAlreadyExists","RequestId":"tx000000000000000000007-005673d4ea-6647f-a"},
From http://docs.ceph.com/docs/master/radosgw/adminops/ ,the error code should be EmailExists
2. use admin api to add a exist key
$ curl -s -X PUT http://ceph1:9090/admin/user?format=json&uid=testuser7&access-key=ZOYBOL2Q1GH5FRQH4IAL&key
get response: {"Code":"BucketAlreadyExists","RequestId":"tx000000000000000000001-005673dfe2-6648e-a"}
From document the error code should be KeyExists
3. add bad caps to user
$ curl -s -X PUT http://ceph1:9090/admin/user?format=json&uid=testuser6&user-caps=usasisdfafsdlgereafsa%2C%20write&caps
got response: "Code":"InvalidArgument","RequestId":"tx000000000000000000001-005673df43-63ef2-a"}
From document the error code should be InvalidCap.
Updated by Dunrong Huang over 8 years ago
pull request;
https://github.com/ceph/ceph/pull/7037