Skip to content

Commit

Permalink
default_storage.exists takes file referenced by name
Browse files Browse the repository at this point in the history
closes pulp#2988
  • Loading branch information
ipanova committed Mar 2, 2023
1 parent 336cca1 commit a6cdd69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/2988.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed 0044_noartifact_modules migration that was failing with object storage.
4 changes: 2 additions & 2 deletions pulp_rpm/app/migrations/0044_noartifact_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ def convert_artifact_to_snippets(apps, schema_editor):

for module in Modulemd.objects.all():
artifact = module._artifacts.get()
if default_storage.exists(artifact.file.path):
if default_storage.exists(artifact.file.name):
module.snippet = artifact.file.read().decode("utf-8")
content_artifact = ContentArtifact.objects.filter(content__pk=module.pk)
content_artifact.delete()
modules_with_snippet.append(module)

for default in ModulemdDefaults.objects.all():
artifact = default._artifacts.get()
if default_storage.exists(artifact.file.path):
if default_storage.exists(artifact.file.name):
default.snippet = artifact.file.read().decode("utf-8")
content_artifact = ContentArtifact.objects.filter(content__pk=default.pk)
content_artifact.delete()
Expand Down

0 comments on commit a6cdd69

Please sign in to comment.