mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 08:47:40 +00:00
Merge pull request #14 from guewen/9.0-better-s3-access-error-msg
[9.0] Make error message more precise for S3 access
This commit is contained in:
committed by
GitHub
co-authored by
GitHub
commit
7f5f6d0f92
@@ -135,14 +135,18 @@ class IrAttachment(models.Model):
|
|||||||
else:
|
else:
|
||||||
bucket_name = os.environ.get('AWS_BUCKETNAME')
|
bucket_name = os.environ.get('AWS_BUCKETNAME')
|
||||||
if not (access_key and secret_key and bucket_name):
|
if not (access_key and secret_key and bucket_name):
|
||||||
raise exceptions.UserError(
|
msg = _('If you want to read from the %s S3 bucket, the following '
|
||||||
_('The following environment variables must be set:\n'
|
'environment variables must be set:\n'
|
||||||
'* AWS_ACCESS_KEY_ID\n'
|
'* AWS_ACCESS_KEY_ID\n'
|
||||||
'* AWS_SECRET_ACCESS_KEY\n'
|
'* AWS_SECRET_ACCESS_KEY\n'
|
||||||
|
'If you want to write in the %s S3 bucket, this variable '
|
||||||
|
'must be set as well:\n'
|
||||||
'* AWS_BUCKETNAME\n'
|
'* AWS_BUCKETNAME\n'
|
||||||
'* AWS_HOST (optional)\n'
|
'Optionally, the S3 host can be changed with:\n'
|
||||||
)
|
'* AWS_HOST\n'
|
||||||
)
|
) % (bucket_name, bucket_name)
|
||||||
|
|
||||||
|
raise exceptions.UserError(msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn = connect_s3(aws_access_key_id=access_key,
|
conn = connect_s3(aws_access_key_id=access_key,
|
||||||
|
|||||||
Reference in New Issue
Block a user