mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 08:47:40 +00:00
Add AWS_BUCKETNAME_UNSTRUCTURED to by-pass check
Curently the name of the bucket is cross checked with the running environment. In rare case you can have a bucket name that doesn't match the structure <project>-odoo-<env> in place.
This commit is contained in:
@@ -81,6 +81,10 @@ Besides, the attachment location should be set to `s3` (this is
|
|||||||
automatically done by the `install` methods of the `cloud_platform` module).
|
automatically done by the `install` methods of the `cloud_platform` module).
|
||||||
* `ir.config_parameter` `ir_attachment.location`: `s3`
|
* `ir.config_parameter` `ir_attachment.location`: `s3`
|
||||||
|
|
||||||
|
Structure of bucket name is checked against environment.
|
||||||
|
It is possible to by-pass this behavior by using the following environment variable:
|
||||||
|
`AWS_BUCKETNAME_UNSTRUCTURED`.
|
||||||
|
|
||||||
|
|
||||||
### Attachments in the Object Storage Swift
|
### Attachments in the Object Storage Swift
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,13 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
"If you don't actually need a bucket, change the"
|
"If you don't actually need a bucket, change the"
|
||||||
" 'ir_attachment.location' parameter."
|
" 'ir_attachment.location' parameter."
|
||||||
)
|
)
|
||||||
|
# A bucket name is defined under the following format
|
||||||
|
# <client>-odoo-<env>
|
||||||
|
#
|
||||||
|
# Use AWS_BUCKETNAME_UNSTRUCTURED to by-pass check on bucket name
|
||||||
|
# structure
|
||||||
|
if os.environ.get('AWS_BUCKETNAME_UNSTRUCTURED'):
|
||||||
|
return
|
||||||
prod_bucket = bool(re.match(r'[a-z-0-9]+-odoo-prod', bucket_name))
|
prod_bucket = bool(re.match(r'[a-z-0-9]+-odoo-prod', bucket_name))
|
||||||
if environment_name == 'prod':
|
if environment_name == 'prod':
|
||||||
assert prod_bucket, (
|
assert prod_bucket, (
|
||||||
|
|||||||
Reference in New Issue
Block a user