From de2515a7bf97a04529a280fd6734057d078236dd Mon Sep 17 00:00:00 2001 From: Josh Schneier Date: Sun, 2 Feb 2020 23:06:08 -0800 Subject: [PATCH] [s3] Deprecate additional settings (#829) --- docs/backends/amazon-S3.rst | 5 +++++ storages/backends/s3boto3.py | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/backends/amazon-S3.rst b/docs/backends/amazon-S3.rst index 6dccbad1a..abe74b689 100644 --- a/docs/backends/amazon-S3.rst +++ b/docs/backends/amazon-S3.rst @@ -87,6 +87,11 @@ To allow ``django-admin.py`` collectstatic to automatically put your static file ``AWS_S3_ENCRYPTION`` (optional; default is ``False``) Enable server-side file encryption while at rest. +.. deprecated:: 1.9 + + Support for this top level setting is deprecated. The functionality is still available by setting + ServerSideEncryption=AES256 in AWS_S3_OBJECT_PARAMETERS. + ``AWS_S3_FILE_OVERWRITE`` (optional: default is ``True``) By default files with the same name will overwrite each other. Set this to ``False`` to have extra characters appended. diff --git a/storages/backends/s3boto3.py b/storages/backends/s3boto3.py index af3b3b48b..56502afdd 100644 --- a/storages/backends/s3boto3.py +++ b/storages/backends/s3boto3.py @@ -283,6 +283,27 @@ def __init__(self, acl=None, bucket=None, **settings): "Unset AWS_AUTO_CREATE_BUCKET (it defaults to False) to silence this warning.", DeprecationWarning, ) + if self.reduced_redundancy: + warnings.warn( + "Support for AWS_REDUCED_REDUNDANCY will be removed in version 2.0. " + "Update now by adding StorageClass=REDUCED_REDUNDANCY to " + "AWS_S3_OBJECT_PARAMETERS. There are also several other possible values " + "for StorageClass available. Check the AWS & boto3 docs for more info.", + DeprecationWarning, + ) + if self.encryption: + warnings.warn( + "Support for AWS_S3_ENCRYPTION will be removed in version 2.0. " + "Update now by adding ServerSideEncryption=AES256 to " + "AWS_S3_OBJECT_PARAMETERS. Doing so also easily allows using 'aws:kms' " + "for encryption. Check the AWS & boto3 docs for more info.", + DeprecationWarning, + ) + if self.preload_metadata: + warnings.warn( + "Support for AWS_PRELOAD_METADATA will be removed in version 2.0. ", + DeprecationWarning, + ) check_location(self)