ceph: fix GetUser

Stop check for the output, but read it instead.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-06-29 16:08:35 +02:00
1 parent c37d8c9c2a
commit 1efd490900
1 file changed
+3 -3
+3 -3
View File
@@ -92,11 +92,11 @@ func GetUser(c *Context, id string) (*ObjectUser, int, error) {
// note: err is set for non-existent user but result output is also empty
result, err := runAdminCommand(c, "user", "info", "--uid", id)
if len(result) == 0 {
return nil, RGWErrorNotFound, errors.New("warn: user not found")
if strings.Contains(result, "no user info saved") {
return nil, RGWErrorNotFound, errors.New("warn: s3 user not found")
}
if err != nil {
return nil, RGWErrorUnknown, errors.Wrap(err, "radosgw-admin command err")
return nil, RGWErrorUnknown, errors.Wrapf(err, "radosgw-admin command err. %s", result)
}
return decodeUser(result)
}