Skip to content

Commit

Permalink
Replace deprecated DEFAULT_FILE_STORAGE with STORAGES
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-psb authored and ggainey committed Jan 13, 2025
1 parent e47f75b commit bf5c789
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pulp_container/app/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def _dispatch(artifact, headers):
full_headers["Docker-Content-Digest"] = headers["Docker-Content-Digest"]
full_headers["Docker-Distribution-API-Version"] = "registry/2.0"

if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem":
if settings.STORAGES["default"]["BACKEND"] == "pulpcore.app.models.storage.FileSystem":
file = artifact.file
path = os.path.join(settings.MEDIA_ROOT, file.name)
if not os.path.exists(path):
Expand Down
9 changes: 6 additions & 3 deletions pulp_container/app/registry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,13 +966,16 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

if (
settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem"
settings.STORAGES["default"]["BACKEND"] == "pulpcore.app.models.storage.FileSystem"
or not settings.REDIRECT_TO_OBJECT_STORAGE
):
self.redirects_class = FileStorageRedirects
elif settings.DEFAULT_FILE_STORAGE == "storages.backends.s3boto3.S3Boto3Storage":
elif settings.STORAGES["default"]["BACKEND"] == "storages.backends.s3boto3.S3Boto3Storage":
self.redirects_class = S3StorageRedirects
elif settings.DEFAULT_FILE_STORAGE == "storages.backends.azure_storage.AzureStorage":
elif (
settings.STORAGES["default"]["BACKEND"]
== "storages.backends.azure_storage.AzureStorage"
):
self.redirects_class = AzureStorageRedirects
else:
raise NotImplementedError()
Expand Down
2 changes: 1 addition & 1 deletion pulp_container/app/tasks/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def create_signature(manifest, reference, signing_service):
if not manifest.data:
# TODO: BACKWARD COMPATIBILITY - remove after fully migrating to artifactless manifest
artifact = await manifest._artifacts.aget()
if settings.DEFAULT_FILE_STORAGE != "pulpcore.app.models.storage.FileSystem":
if settings.STORAGES["default"]["BACKEND"] != "pulpcore.app.models.storage.FileSystem":
async with tempfile.NamedTemporaryFile(dir=".", mode="wb", delete=False) as tf:
await tf.write(await sync_to_async(artifact.file.read)())
await tf.flush()
Expand Down

0 comments on commit bf5c789

Please sign in to comment.