diff --git a/swift/common/middleware/s3api/s3api.py b/swift/common/middleware/s3api/s3api.py index 42cef6024d..9c225c53b9 100644 --- a/swift/common/middleware/s3api/s3api.py +++ b/swift/common/middleware/s3api/s3api.py @@ -452,13 +452,15 @@ def filter_factory(global_conf, **local_conf): register_swift_info( 's3api', # TODO: make default values as variables - max_bucket_listing=conf.get('max_bucket_listing', 1000), - max_parts_listing=conf.get('max_parts_listing', 1000), - max_upload_part_num=conf.get('max_upload_part_num', 1000), - max_multi_delete_objects=conf.get('max_multi_delete_objects', 1000), - allow_multipart_uploads=conf.get('allow_multipart_uploads', True), - min_segment_size=conf.get('min_segment_size', 5242880), - s3_acl=conf.get('s3_acl', False) + max_bucket_listing=int(conf.get('max_bucket_listing', 1000)), + max_parts_listing=int(conf.get('max_parts_listing', 1000)), + max_upload_part_num=int(conf.get('max_upload_part_num', 1000)), + max_multi_delete_objects=int( + conf.get('max_multi_delete_objects', 1000)), + allow_multipart_uploads=config_true_value( + conf.get('allow_multipart_uploads', True)), + min_segment_size=int(conf.get('min_segment_size', 5242880)), + s3_acl=config_true_value(conf.get('s3_acl', False)), ) def s3api_filter(app): diff --git a/test/unit/common/middleware/s3api/test_s3api.py b/test/unit/common/middleware/s3api/test_s3api.py index 81db1edd90..57a2cde6e6 100644 --- a/test/unit/common/middleware/s3api/test_s3api.py +++ b/test/unit/common/middleware/s3api/test_s3api.py @@ -868,7 +868,8 @@ class TestS3ApiMiddleware(S3ApiTestCase): self.assertEqual(elem.find('./ResourceType').text, 'ACL') def test_registered_defaults(self): - filter_factory(self.conf) + conf_from_file = {k: str(v) for k, v in self.conf.items()} + filter_factory(conf_from_file) swift_info = utils.get_swift_info() self.assertTrue('s3api' in swift_info) self.assertEqual(swift_info['s3api'].get('max_bucket_listing'),