Skip to content

Commit

Permalink
Add support for Replicate feature
Browse files Browse the repository at this point in the history
Placeholder text.
  • Loading branch information
MichalPysik committed Jun 2, 2024
1 parent 7cab423 commit 4b537c8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pulp_container/app/replica.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from pulpcore.plugin.replica import Replicator

from pulp_glue.container.context import (
PulpContainerDistributionContext,
PulpContainerRepositoryContext,
)

from pulp_container.app.models import ContainerDistribution, ContainerRemote, ContainerRepository
from pulp_container.app.tasks import synchronize as container_synchronize


class ContainerReplicator(Replicator):
distribution_ctx_cls = PulpContainerDistributionContext
repository_ctx_cls = PulpContainerRepositoryContext
publication_ctx_cls = None
remote_model_cls = ContainerRemote
repository_model_cls = ContainerRepository
distribution_model_cls = ContainerDistribution
distribution_serializer_name = "ContainerDistributionSerializer"
repository_serializer_name = "ContainerRepositorySerializer"
remote_serializer_name = "ContainerRemoteSerializer"
app_label = "container"
sync_task = container_synchronize

def sync_params(self, repository, remote):
"""Returns a dictionary where key is a parameter for the sync task."""
return dict(
remote_pk=str(remote.pk),
repository_pk=str(repository.pk),
mirror=True,
)


REPLICATION_ORDER = [ContainerReplicator]

0 comments on commit 4b537c8

Please sign in to comment.