Merge pull request #20 from guewen/10.0-object-storage-container-not-empty-check

Add check for empty bucket on integration
This commit is contained in:
Guewen Baconnier
2017-11-15 14:59:23 +01:00
committed by GitHub
co-authored by GitHub
+10
View File
@@ -110,6 +110,11 @@ class CloudPlatform(models.AbstractModel):
"ir_attachment.location is 'swift'."
)
container_name = os.environ['SWIFT_WRITE_CONTAINER']
if environment_name in ('integration', 'prod'):
assert container_name, (
"SWIFT_WRITE_CONTAINER must not be empty for prod "
"and integration"
)
prod_container = bool(re.match(r'[a-z]+-odoo-prod',
container_name))
if environment_name == 'prod':
@@ -161,6 +166,11 @@ class CloudPlatform(models.AbstractModel):
"integration/prod bucket)."
)
bucket_name = os.environ['AWS_BUCKETNAME']
if environment_name in ('integration', 'prod'):
assert bucket_name, (
"AWS_BUCKETNAME must not be empty for prod "
"and integration"
)
prod_bucket = bool(re.match(r'[a-z]+-odoo-prod', bucket_name))
if environment_name == 'prod':
assert prod_bucket, (