From 1efd490900a1937e2d60d9c9e0a5ab0676142c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Mon, 29 Jun 2020 16:06:38 +0200 Subject: [PATCH] ceph: fix GetUser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop check for the output, but read it instead. Signed-off-by: Sébastien Han --- pkg/operator/ceph/object/user.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/operator/ceph/object/user.go b/pkg/operator/ceph/object/user.go index febf079a2..762a271a2 100644 --- a/pkg/operator/ceph/object/user.go +++ b/pkg/operator/ceph/object/user.go @@ -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) }