EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 4768c36c authored by Fabian Schindler's avatar Fabian Schindler
Browse files

Use more unique name for storage auth

parent 269f8539
No related branches found
No related tags found
1 merge request!82Staging to master
...@@ -73,8 +73,10 @@ class EOxServerBackend(Backend): ...@@ -73,8 +73,10 @@ class EOxServerBackend(Backend):
elif endpoint_url.startswith('http://'): elif endpoint_url.startswith('http://'):
endpoint_url = endpoint_url[len('http://'):] endpoint_url = endpoint_url[len('http://'):]
bucket, _ = source.get_container_and_path(path)
storage_auth, created_storage_auth = backends.StorageAuth.objects.get_or_create( storage_auth, created_storage_auth = backends.StorageAuth.objects.get_or_create(
name=endpoint_url, name=source.name if source.bucket_name else f'{source.name}-{bucket}',
url=endpoint_url, url=endpoint_url,
storage_auth_type='S3', storage_auth_type='S3',
) )
...@@ -82,8 +84,6 @@ class EOxServerBackend(Backend): ...@@ -82,8 +84,6 @@ class EOxServerBackend(Backend):
storage_auth.auth_parameters = params storage_auth.auth_parameters = params
storage_auth.save() storage_auth.save()
bucket, _ = source.get_container_and_path(path)
storage, created_storage = backends.Storage.objects.get_or_create( storage, created_storage = backends.Storage.objects.get_or_create(
name=source.name if source.bucket_name else f'{source.name}-{bucket}', name=source.name if source.bucket_name else f'{source.name}-{bucket}',
url=bucket, url=bucket,
...@@ -136,7 +136,7 @@ class EOxServerBackend(Backend): ...@@ -136,7 +136,7 @@ class EOxServerBackend(Backend):
if not mapping: if not mapping:
raise RegistrationError(f'Could not get mapping for {item.product_type} {item.product_level}') raise RegistrationError(f'Could not get mapping for {item.product_type} {item.product_level}')
try: try:
_, metadata_file = source.get_container_and_path(item.metadata_files[0]) _, metadata_file = source.get_container_and_path(item.metadata_files[0])
metadata_locations = [storage + [metadata_file]] metadata_locations = [storage + [metadata_file]]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment