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
Conversation
@@ -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 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ret == -ENOENT)
There was a problem hiding this comment.
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 :)
3d7c5ef
to
2fc2457
Compare
@@ -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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
2fc2457
to
913ab64
Compare
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattbenjamin done.
913ab64
to
84b0471
Compare
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>
84b0471
to
b9a2048
Compare
@oritwas ping |
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