From: Avan Thakkar Date: Fri, 20 Aug 2021 09:07:17 +0000 (+0530) Subject: mgr/dashboard: stats=false not working when listing buckets X-Git-Tag: v15.2.15~46^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=08f28e6322a3aa40bd9cdb48d507fb2fe6487849;p=ceph.git mgr/dashboard: stats=false not working when listing buckets Fixes: https://tracker.ceph.com/issues/51154 Signed-off-by: Avan Thakkar (cherry picked from commit 95543bb150fc9e458314e62d80667190863caa0b) Conflicts: src/pybind/mgr/dashboard/controllers/rgw.py - rgw-list endpoint doesn't have daemon_name parameter in octopus, so adopted changes accordingly. --- diff --git a/qa/tasks/mgr/dashboard/test_rgw.py b/qa/tasks/mgr/dashboard/test_rgw.py index 9760276a3d3a..be7729df848d 100644 --- a/qa/tasks/mgr/dashboard/test_rgw.py +++ b/qa/tasks/mgr/dashboard/test_rgw.py @@ -223,6 +223,11 @@ class RgwBucketTest(RgwTestCase): 'tenant': JLeaf(str), }, allow_unknown=True)) + # List all buckets names without stats. + data = self._get('/api/rgw/bucket?stats=false') + self.assertStatus(200) + self.assertEqual(data, ['teuth-test-bucket']) + # Get the bucket. data = self._get('/api/rgw/bucket/teuth-test-bucket') self.assertStatus(200) diff --git a/src/pybind/mgr/dashboard/controllers/rgw.py b/src/pybind/mgr/dashboard/controllers/rgw.py index f3a885a21ac3..ae1c2df6bcef 100644 --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@ -208,7 +208,7 @@ class RgwBucket(RgwRESTController): def list(self, stats=False): # type: (bool) -> List[Any] - query_params = '?stats' if stats else '' + query_params = '?stats' if str_to_bool(stats) else '' result = self.proxy('GET', 'bucket{}'.format(query_params)) if stats: