Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django storages config deprecation (1/2) #1889

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading