From: Yuval Lifshitz Date: Wed, 14 Aug 2024 10:41:18 +0000 (+0000) Subject: rgw/notifications: fixing radosgw-admin notification json X-Git-Tag: v20.0.0~1260^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=24d98f4842b3b02d35675973a13093dd5b3b2b99;p=ceph.git rgw/notifications: fixing radosgw-admin notification json Fixes: https://tracker.ceph.com/issues/67525 Signed-off-by: Yuval Lifshitz --- diff --git a/src/rgw/rgw_pubsub.cc b/src/rgw/rgw_pubsub.cc index 120f21062b407..92b65b0ebba04 100644 --- a/src/rgw/rgw_pubsub.cc +++ b/src/rgw/rgw_pubsub.cc @@ -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) { diff --git a/src/test/rgw/bucket_notification/test_bn.py b/src/test/rgw/bucket_notification/test_bn.py index bdb302511f472..d709503afb26b 100644 --- a/src/test/rgw/bucket_notification/test_bn.py +++ b/src/test/rgw/bucket_notification/test_bn.py @@ -828,18 +828,44 @@ def notification_configuration(with_cli): 'arn:aws:sns:' + zonegroup + '::' + topic_name) # 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)