Skip to content

Commit 489919e

Browse files
authored
Merge pull request ceph#59218 from yuvalif/wip-yuval-67525
rgw/notifications: fixing radosgw-admin notification json Reviewed-by: Casey Bodley <[email protected]>
2 parents 44c4a17 + 24d98f4 commit 489919e

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

src/rgw/rgw_pubsub.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void rgw_s3_key_filter::dump(Formatter *f) const {
8585
::encode_json("Value", regex_rule, f);
8686
f->close_section();
8787
}
88+
f->close_section();
8889
}
8990

9091
bool rgw_s3_key_filter::decode_xml(XMLObj* obj) {
@@ -151,6 +152,7 @@ void rgw_s3_key_value_filter::dump(Formatter *f) const {
151152
::encode_json("Value", key_value.second, f);
152153
f->close_section();
153154
}
155+
f->close_section();
154156
}
155157

156158
bool rgw_s3_key_value_filter::decode_xml(XMLObj* obj) {

src/test/rgw/bucket_notification/test_bn.py

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -828,18 +828,44 @@ def notification_configuration(with_cli):
828828
'arn:aws:sns:' + zonegroup + '::' + topic_name)
829829
# create s3 notification
830830
notification_name = bucket_name + NOTIFICATION_SUFFIX
831-
topic_conf_list = [{'Id': notification_name+'_1',
831+
topic_conf_list = [
832+
{
833+
'Id': notification_name+'_1',
832834
'TopicArn': topic_arn,
833-
'Events': ['s3:ObjectCreated:*']
834-
},
835-
{'Id': notification_name+'_2',
835+
'Events': ['s3:ObjectCreated:*'],
836+
'Filter': {
837+
'Key': {
838+
'FilterRules': [
839+
{'Name': 'prefix', 'Value': 'test'},
840+
{'Name': 'suffix', 'Value': 'txt'}
841+
]
842+
}
843+
}
844+
},
845+
{
846+
'Id': notification_name+'_2',
836847
'TopicArn': topic_arn,
837-
'Events': ['s3:ObjectRemoved:*']
838-
},
839-
{'Id': notification_name+'_3',
848+
'Events': ['s3:ObjectRemoved:*'],
849+
'Filter': {
850+
'Metadata': {
851+
'FilterRules': [
852+
{'Name': 'x-amz-meta-foo', 'Value': 'bar'},
853+
{'Name': 'x-amz-meta-hello', 'Value': 'world'}]
854+
},
855+
}
856+
},
857+
{
858+
'Id': notification_name+'_3',
840859
'TopicArn': topic_arn,
841-
'Events': []
842-
}]
860+
'Events': [],
861+
'Filter': {
862+
'Tags': {
863+
'FilterRules': [
864+
{'Name': 'tag1', 'Value': 'value1'},
865+
{'Name': 'tag2', 'Value': 'value2'}]
866+
}
867+
}
868+
}]
843869
s3_notification_conf = PSNotificationS3(conn, bucket_name, topic_conf_list)
844870
_, status = s3_notification_conf.set_config()
845871
assert_equal(status/100, 2)

0 commit comments

Comments
 (0)