]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/notifications: fixing radosgw-admin notification json
authorYuval Lifshitz <ylifshit@ibm.com>
Wed, 14 Aug 2024 10:41:18 +0000 (10:41 +0000)
committerYuval Lifshitz <ylifshit@ibm.com>
Mon, 19 Aug 2024 10:58:06 +0000 (10:58 +0000)
Fixes: https://tracker.ceph.com/issues/67525
Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
(cherry picked from commit 24d98f4842b3b02d35675973a13093dd5b3b2b99)

src/rgw/rgw_pubsub.cc
src/test/rgw/bucket_notification/test_bn.py

index 37538aa7a9b6c9eeb74f3b0bdda5aae2ffea8c25..7eca57e4308666c2942f18fcc162bdd53b43bd23 100644 (file)
@@ -85,6 +85,7 @@ void rgw_s3_key_filter::dump(Formatter *f) const {
     ::encode_json("Value", regex_rule, f);
     f->close_section();
   }
+  f->close_section();
 }
 
 bool rgw_s3_key_filter::decode_xml(XMLObj* obj) {
@@ -151,6 +152,7 @@ void rgw_s3_key_value_filter::dump(Formatter *f) const {
     ::encode_json("Value", key_value.second, f);
     f->close_section();
   }
+  f->close_section();
 }
 
 bool rgw_s3_key_value_filter::decode_xml(XMLObj* obj) {
index 415cb9947938955480c9106ebc1190d7efb73861..c2d710ac36aab93daa2b389304c5569ca62ed226 100644 (file)
@@ -735,18 +735,44 @@ def test_ps_s3_notification_configuration_admin_on_master():
                  'arn:aws:sns:' + zonegroup + '::' + topic_name + '_1')
     # create s3 notification
     notification_name = bucket_name + NOTIFICATION_SUFFIX
-    topic_conf_list = [{'Id': notification_name+'_1',
+    topic_conf_list = [
+                    {
+                        'Id': notification_name+'_1',
                         'TopicArn': topic_arn,
-                        'Events': ['s3:ObjectCreated:*']
-                        },
-                       {'Id': notification_name+'_2',
+                        'Events': ['s3:ObjectCreated:*'],
+                        'Filter': {
+                            'Key': {
+                                'FilterRules': [
+                                    {'Name': 'prefix', 'Value': 'test'},
+                                    {'Name': 'suffix', 'Value': 'txt'}
+                                ]
+                            }
+                        }
+                    },
+                    {
+                        'Id': notification_name+'_2',
                         'TopicArn': topic_arn,
-                        'Events': ['s3:ObjectRemoved:*']
-                        },
-                       {'Id': notification_name+'_3',
+                        'Events': ['s3:ObjectRemoved:*'],
+                        'Filter': {
+                            'Metadata': {
+                                'FilterRules': [
+                                    {'Name': 'x-amz-meta-foo', 'Value': 'bar'},
+                                    {'Name': 'x-amz-meta-hello', 'Value': 'world'}]
+                            },
+                        }
+                    },
+                    {
+                        'Id': notification_name+'_3',
                         'TopicArn': topic_arn,
-                        'Events': []
-                        }]
+                        'Events': [],
+                        'Filter': {
+                            'Tags': {
+                                'FilterRules': [
+                                    {'Name': 'tag1', 'Value': 'value1'},
+                                    {'Name': 'tag2', 'Value': 'value2'}]
+                            }
+                        }
+                    }]
     s3_notification_conf = PSNotificationS3(conn, bucket_name, topic_conf_list)
     _, status = s3_notification_conf.set_config()
     assert_equal(status/100, 2)