From 05b7711516350d16b3e85d17c57b726b82d434a4 Mon Sep 17 00:00:00 2001 From: Fabian Schindler <fabian.schindler.strauss@gmail.com> Date: Mon, 2 Nov 2020 09:32:21 +0100 Subject: [PATCH] Fixing cases for multi-bucket/container setup --- core/registrar/backend.py | 5 +++-- core/registrar/registrar.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/registrar/backend.py b/core/registrar/backend.py index 46c07a12..3bdb14d7 100644 --- a/core/registrar/backend.py +++ b/core/registrar/backend.py @@ -54,6 +54,7 @@ class EOxServerBackend(Backend): storage_type='local', ) storage_name = storage.name + elif isinstance(source, S3Source): params = json.dumps({ 'ACCESS_KEY_ID': source.access_key_id, @@ -70,7 +71,7 @@ class EOxServerBackend(Backend): bucket, _ = source.get_bucket_and_key(path) storage, created_storage = backends.Storage.objects.get_or_create( - name=source.name, + name=source.name if source.bucket else f'{source.name}-{bucket}', url=bucket, storage_type='S3', storage_auth=storage_auth, @@ -98,7 +99,7 @@ class EOxServerBackend(Backend): container, _ = source.get_container_and_path(path) storage, created_storage = backends.Storage.objects.get_or_create( - name=source.name, + name=source.name if source.container else f'{source.name}-{container}', url=container, storage_type='swift', storage_auth=storage_auth, diff --git a/core/registrar/registrar.py b/core/registrar/registrar.py index 53c9b102..7630613d 100644 --- a/core/registrar/registrar.py +++ b/core/registrar/registrar.py @@ -35,6 +35,7 @@ def register_file(config: dict, path: str, replace: bool=False): for post_handler in get_post_handlers(config): post_handler(config, path, context) + logger.info(f"Successfully {'replaced' if replace else 'registered'} '{path}'") return context -- GitLab