diff --git a/CHANGES/4219.bugfix b/CHANGES/4219.bugfix new file mode 100644 index 0000000000..33425a8354 --- /dev/null +++ b/CHANGES/4219.bugfix @@ -0,0 +1 @@ +Fixed a bug where ca_cert was not getting set for replication remotes. diff --git a/pulpcore/app/replica.py b/pulpcore/app/replica.py index 3ace2d128e..bd19a5ea4d 100644 --- a/pulpcore/app/replica.py +++ b/pulpcore/app/replica.py @@ -28,13 +28,15 @@ class Replicator: app_label = None sync_task = None - def __init__(self, pulp_ctx, task_group): + def __init__(self, pulp_ctx, task_group, ca_cert=None): """ :param pulp_ctx: PulpReplicaContext :param task_group: TaskGroup + :param ca_cert: str """ self.pulp_ctx = pulp_ctx self.task_group = task_group + self.ca_cert = ca_cert self.domain = get_domain() uri = "/api/v3/distributions/" if settings.DOMAIN_ENABLED: @@ -88,6 +90,7 @@ def create_or_update_remote(self, upstream_distribution): ) remote_fields_dict = self.remote_extra_fields(upstream_distribution) remote_fields_dict["url"] = url + remote_fields_dict["ca_cert"] = self.ca_cert needs_update = self.needs_update(remote_fields_dict, remote) if needs_update: dispatch( @@ -102,6 +105,7 @@ def create_or_update_remote(self, upstream_distribution): remote = self.remote_model_cls(name=upstream_distribution["name"], url=url) for field_name, value in self.remote_extra_fields(upstream_distribution).items(): setattr(remote, field_name, value) + remote.ca_cert = self.ca_cert remote.save() return remote diff --git a/pulpcore/app/tasks/replica.py b/pulpcore/app/tasks/replica.py index 283c63aab9..cfc50e83d6 100644 --- a/pulpcore/app/tasks/replica.py +++ b/pulpcore/app/tasks/replica.py @@ -64,7 +64,9 @@ def replicate_distributions(server_pk): for config in pulp_plugin_configs(): if config.replicator_classes: for replicator_class in config.replicator_classes: - supported_replicators.append(replicator_class(ctx, task_group)) + supported_replicators.append( + replicator_class(ctx, task_group, ca_cert=server.ca_cert) + ) for replicator in supported_replicators: distros = replicator.upstream_distributions(labels=server.pulp_label_select)