From: Ali Masarwa Date: Sun, 23 Mar 2025 11:31:38 +0000 (+0200) Subject: RGW|Bucket Notification: fix for v2 topics rgw-admin list operation X-Git-Tag: v20.3.0~252^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3f0428a017cdf35b7290cf7836eb4baa4eb0e774;p=ceph.git RGW|Bucket Notification: fix for v2 topics rgw-admin list operation Signed-off-by: Ali Masarwa --- diff --git a/src/rgw/radosgw-admin/radosgw-admin.cc b/src/rgw/radosgw-admin/radosgw-admin.cc index b886d59f68d65..aa360e1557584 100644 --- a/src/rgw/radosgw-admin/radosgw-admin.cc +++ b/src/rgw/radosgw-admin/radosgw-admin.cc @@ -11514,7 +11514,6 @@ next: owner = rgw_account_id{account_id}; } - formatter->open_object_section("result"); rgw_pubsub_topics result; if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2) && driver->stat_topics_v1(tenant, null_yield, dpp()) == -ENOENT) { @@ -11559,7 +11558,6 @@ next: encode_json("marker", next_token, formatter.get()); } } - formatter->close_section(); // result formatter->flush(cout); } diff --git a/src/test/rgw/bucket_notification/api.py b/src/test/rgw/bucket_notification/api.py index e84aa16edc753..63b1ec699779e 100644 --- a/src/test/rgw/bucket_notification/api.py +++ b/src/test/rgw/bucket_notification/api.py @@ -247,17 +247,13 @@ def delete_all_topics(conn, tenant, cluster): if tenant == '': topics_result = admin(['topic', 'list'], cluster) topics_json = json.loads(topics_result[0]) - if 'topics' not in topics_json: - topics_json = topics_json.get('result',{}) - for topic in topics_json['topics']: + for topic in topics_json: rm_result = admin(['topic', 'rm', '--topic', topic['name']], cluster) print(rm_result) else: topics_result = admin(['topic', 'list', '--tenant', tenant], cluster) topics_json = json.loads(topics_result[0]) - if 'topics' not in topics_json: - topics_json = topics_json.get('result',{}) - for topic in topics_json['topics']: + for topic in topics_json: rm_result = admin(['topic', 'rm', '--tenant', tenant, '--topic', topic['name']], cluster) print(rm_result) diff --git a/src/test/rgw/bucket_notification/test_bn.py b/src/test/rgw/bucket_notification/test_bn.py index 23e819d74a420..5e3f32a3b7992 100644 --- a/src/test/rgw/bucket_notification/test_bn.py +++ b/src/test/rgw/bucket_notification/test_bn.py @@ -563,7 +563,7 @@ def list_topics(assert_len=None, tenant=''): result = admin(['topic', 'list', '--tenant', tenant], get_config_cluster()) parsed_result = json.loads(result[0]) if assert_len: - assert_equal(len(parsed_result['topics']), assert_len) + assert_equal(len(parsed_result), assert_len) return parsed_result @@ -5780,7 +5780,7 @@ def test_topic_migration_to_an_account(): assert_equal(status / 100, 2) # verify both buckets are subscribed to the topic rgw_topic_entry = [ - t for t in list_topics()["topics"] if t["name"] == topic_name + t for t in list_topics() if t["name"] == topic_name ] assert_equal(len(rgw_topic_entry), 1) subscribed_buckets = rgw_topic_entry[0]["subscribed_buckets"] @@ -5858,7 +5858,7 @@ def test_topic_migration_to_an_account(): # verify subscriptions to the account topic rgw_topic_entry = [ t - for t in list_topics(tenant=account_id)["topics"] + for t in list_topics(tenant=account_id) if t["name"] == topic_name ] assert_equal(len(rgw_topic_entry), 1) @@ -5896,7 +5896,7 @@ def test_topic_migration_to_an_account(): # now verify account topic serves both buckets rgw_topic_entry = [ t - for t in list_topics(tenant=account_id)["topics"] + for t in list_topics(tenant=account_id) if t["name"] == topic_name ] assert_equal(len(rgw_topic_entry), 1)