Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: better error message when user has no bucket created yet #10162

Merged
merged 1 commit into from Jul 23, 2016

Conversation

gaurav36
Copy link
Contributor

@gaurav36 gaurav36 commented Jul 6, 2016

Currently when there is no bucket in the cluster and user execute
"$radosgw-admin user stats --uid=testid" command then rgw admin
not throwing meaningful error message.

With this fix it will show proper meaningful error message.

Fixes: http://tracker.ceph.com/issues/16444

Reported-by: Abhishek Lekshmanan abhishek@suse.com
Signed-off-by: Gaurav Kumar Garg garg.gaurav52@gmail.com

@@ -4817,7 +4817,11 @@ int main(int argc, char **argv)
string user_str = user_id.to_str();
int ret = store->cls_user_get_header(user_str, &header);
if (ret < 0) {
cerr << "ERROR: can't read user header: " << cpp_strerror(-ret) << std::endl;
if (ret == -2) { /* in case of ENOENT */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (ret == -ENOENT)

Copy link
Contributor Author

@gaurav36 gaurav36 Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, will do in next patch thanks @yehudasa :)

@gaurav36 gaurav36 force-pushed the bug-16444-radosgw-error-message branch from 3d7c5ef to 2fc2457 Compare July 7, 2016 08:56
@@ -4817,7 +4817,11 @@ int main(int argc, char **argv)
string user_str = user_id.to_str();
int ret = store->cls_user_get_header(user_str, &header);
if (ret < 0) {
cerr << "ERROR: can't read user header: " << cpp_strerror(-ret) << std::endl;
if (ret == -ENOENT) { /* in case of ENOENT */
cerr << "User has not been initialized " << std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User has not been initialized or doesn't exist would be more appropriate here as the same error is thrown when the user doesn't exist as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gaurav36 gaurav36 force-pushed the bug-16444-radosgw-error-message branch from 2fc2457 to 913ab64 Compare July 7, 2016 09:59
@cbodley cbodley added the rgw label Jul 7, 2016
if (ret == -ENOENT) { /* in case of ENOENT */
cerr << "User has not been initialized or user does not exist" << std::endl;
} else {
cerr << "ERROR: can't read user: " << cpp_strerror(-ret) << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for posterity, cpp_strerror coerces whatever code is passed to be positive, so there's no need to make a code negative

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaurav36 gaurav36 force-pushed the bug-16444-radosgw-error-message branch from 913ab64 to 84b0471 Compare July 7, 2016 16:57
@oritwas oritwas self-assigned this Jul 14, 2016
@yehudasa yehudasa removed their assignment Jul 21, 2016
Currently when there is no bucket in the cluster and user execute
 "$radosgw-admin user  stats --uid=testid" command then rgw admin
not throwing meaningful error message.

With this fix it will show proper meaningful error message.

Fixes: http://tracker.ceph.com/issues/16444

Reported-by: Abhishek Lekshmanan <abhishek@suse.com>
Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
@gaurav36 gaurav36 force-pushed the bug-16444-radosgw-error-message branch from 84b0471 to b9a2048 Compare July 22, 2016 10:15
@yehudasa
Copy link
Member

@oritwas ping

@oritwas oritwas merged commit 7e87eaf into ceph:master Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants