forked from pulp/pulpcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migrate endpoint to move artifacts to another storage backend
fixes: pulp#3358
- Loading branch information
Showing
14 changed files
with
439 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added new `/migrate/` endpoint to Domains that allows for migrating artifacts from one storage backend to another. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
pulpcore/app/migrations/0118_store_default_domain_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 4.2.10 on 2024-04-24 11:38 | ||
|
||
from django.db import migrations | ||
from pulpcore.app.serializers.domain import StorageSettingsSerializer | ||
from django.conf import settings | ||
|
||
|
||
def default_domain_settings(apps, schema_editor): | ||
Domain = apps.get_model("core", "Domain") | ||
default_domain = Domain.objects.get(name="default") | ||
config_settings = StorageSettingsSerializer.get_default_domain_settings(settings) | ||
default_domain.storage_class = settings.DEFAULT_FILE_STORAGE | ||
default_domain.storage_settings = config_settings | ||
default_domain.hide_guarded_distributions = settings.HIDE_GUARDED_DISTRIBUTIONS | ||
default_domain.redirect_to_object_storage = settings.REDIRECT_TO_OBJECT_STORAGE | ||
default_domain.save(skip_hooks=True) | ||
|
||
|
||
def reverse_default_domain_settings(apps, schema_editor): | ||
Domain = apps.get_model("core", "Domain") | ||
default_domain = Domain.objects.get(name="default") | ||
default_domain.storage_settings = {} | ||
default_domain.save(skip_hooks=True) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0117_task_unblocked_at'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(default_domain_settings, reverse_code=reverse_default_domain_settings), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.