Skip to content

Commit

Permalink
Fix replica failing when upstream is missing plugins
Browse files Browse the repository at this point in the history
fixes: #4509
  • Loading branch information
gerrod3 committed Jan 29, 2025
1 parent de23809 commit f72af09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/4509.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed replication failing when the upstream Pulp doesn't have all the same plugins as the downstream.
1 change: 1 addition & 0 deletions pulpcore/app/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Replicator:
remote_serializer_name = None
app_label = None
sync_task = None
required_version = None # A PEP-440 compatible version range required in the Upstream.

def __init__(self, pulp_ctx, task_group, tls_settings, server):
"""
Expand Down
7 changes: 5 additions & 2 deletions pulpcore/app/tasks/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pulpcore.app.replica import ReplicaContext

from pulp_glue.common import __version__ as pulp_glue_version
from pulp_glue.common.context import PluginRequirement


def user_agent():
Expand Down Expand Up @@ -67,8 +68,10 @@ def replicate_distributions(server_pk):
for config in pulp_plugin_configs():
if config.replicator_classes:
for replicator_class in config.replicator_classes:
replicator = replicator_class(ctx, task_group, tls_settings, server)
supported_replicators.append(replicator)
req = PluginRequirement(config.label, specifier=replicator_class.required_version)
if ctx.has_plugin(req):
replicator = replicator_class(ctx, task_group, tls_settings, server)
supported_replicators.append(replicator)

for replicator in supported_replicators:
distros = replicator.upstream_distributions(q=server.q_select)
Expand Down

0 comments on commit f72af09

Please sign in to comment.