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

Add a migration to check for pending datarepair #142

Merged
merged 1 commit into from
Sep 18, 2023
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
1 change: 1 addition & 0 deletions CHANGES/141.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a migration to tell admins to run certain datarepair commands before upgrading to 0.4.
25 changes: 25 additions & 0 deletions pulp_gem/app/migrations/0009_check_datarepair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.1 on 2023-08-15 12:44

from django.db import migrations
from pulpcore.plugin.migrations import RequireVersion


def check_datarepair(apps, schema_editor):
ShallowGemContent = apps.get_model("gem", "ShallowGemContent")
if ShallowGemContent.objects.exists():
raise RuntimeError("Before continuing with this upgrade, you need to run the 'datarepair-shallow-gems' command, or remove all remaining broken repository versions.")

GemContent = apps.get_model("gem", "GemContent")
if GemContent.objects.filter(platform=None).exists():
raise RuntimeError("Before continuing with this upgrade, you need to run the 'datarepair-gemspec-platform' command, or remove all remaining broken repository versions.")


class Migration(migrations.Migration):
dependencies = [
("gem", "0008_gemcontent_platform"),
]

operations = [
RequireVersion("gem", "0.2.0"),
migrations.RunPython(code=check_datarepair, reverse_code=migrations.RunPython.noop, elidable=True),
]
2 changes: 1 addition & 1 deletion pulp_gem/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class GemRepository(Repository):
"""

TYPE = "gem"
CONTENT_TYPES = [GemContent, ShallowGemContent]
CONTENT_TYPES = [GemContent]
REMOTE_TYPES = [GemRemote]

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pulpcore>=3.28.0,<3.40
pulpcore>=3.34.0,<3.40
rubymarshal>=1.2.7,<1.3
Loading