From 9aea5d40a50f35bea5c924caae91a1de6dae9ebd Mon Sep 17 00:00:00 2001 From: Patrick Tombez Date: Wed, 13 Oct 2021 10:13:05 +0200 Subject: [PATCH] fix: Update bucket name format for new convention defined in platform specifications --- cloud_platform_azure/models/cloud_platform.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cloud_platform_azure/models/cloud_platform.py b/cloud_platform_azure/models/cloud_platform.py index 23b39ec..a0f50a6 100644 --- a/cloud_platform_azure/models/cloud_platform.py +++ b/cloud_platform_azure/models/cloud_platform.py @@ -91,23 +91,24 @@ class CloudPlatform(models.AbstractModel): " 'ir_attachment.location' parameter." ) # A bucket name is defined under the following format - # -odoo- + # ^[a-z]+_[a-z]+_\d+$ + # Anything other than prod bucket must be suffixed with env name # # Use AZURE_STORAGE_NAME_UNSTRUCTURED to by-pass check # on bucket name structure if os.environ.get("AZURE_STORAGE_NAME_UNSTRUCTURED"): return - prod_bucket = bool(re.match(r"[a-z-0-9]+-odoo-prod", storage_name)) + prod_bucket = bool(re.match(r"^[a-z]+_[a-z]+_\d+$", storage_name)) if environment_name == "prod": assert prod_bucket, ( - "AZURE_STORAGE_NAME should match '-odoo-prod', " + "AZURE_STORAGE_NAME should match '^[a-z]+_[a-z]+_\\d+$', " "we got: '%s'" % (storage_name,) ) else: # if we are using the prod bucket on another instance # such as an integration, we must be sure to be in read only! assert not prod_bucket, ( - "AZURE_STORAGE_NAME should not match '-odoo-prod', " + "AZURE_STORAGE_NAME should not match '^[a-z]+_[a-z]+_\\d+$', " "we got: '%s'" % (storage_name,) )