]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW|Bucket Notification: fix for v2 topics rgw-admin list operation 62458/head
authorAli Masarwa <amasarwa@redhat.com>
Sun, 23 Mar 2025 11:31:38 +0000 (13:31 +0200)
committerAli Masarwa <amasarwa@redhat.com>
Wed, 26 Mar 2025 15:23:53 +0000 (17:23 +0200)
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
src/rgw/radosgw-admin/radosgw-admin.cc
src/test/rgw/bucket_notification/api.py
src/test/rgw/bucket_notification/test_bn.py

index b886d59f68d6543977c95df2174a2632d712c1ff..aa360e15575846a31dcc3a020335499afc5dbc0b 100644 (file)
@@ -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);
   }
 
index e84aa16edc753f91766f4f74b7d773daf6136ea2..63b1ec699779e593555c37f4d19981f0aecfa914 100644 (file)
@@ -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)
 
index 23e819d74a420c766ff708d70cbd830ece626b8e..5e3f32a3b7992ab2964c2229b8296079bd429cc8 100644 (file)
@@ -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)