Skip to content
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/+proxy-sync-regression-313.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a proxy sync regression introduced in 3.13.0.
17 changes: 15 additions & 2 deletions pulp_python/app/tasks/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
from aiohttp import ClientResponseError, ClientError
from lxml.etree import LxmlError
from gettext import gettext as _
from functools import partial

from rest_framework import serializers

from pulpcore.plugin.download import HttpDownloader
from pulpcore.plugin.models import Artifact, ProgressReport, Remote, Repository
from pulpcore.plugin.stages import (
DeclarativeArtifact,
Expand Down Expand Up @@ -112,11 +114,22 @@ async def run(self):
"""
# Bandersnatch includes leading slash when forming API urls
url = self.remote.url.rstrip("/")
downloader = self.remote.get_downloader(url=url)
if not isinstance(downloader, HttpDownloader):
raise ValueError("Only HTTP(S) is supported for python syncing")

async with Master(url) as master:
# Replace the session with the remote's downloader session
old_session = master.session
factory = self.remote.download_factory
master.session = factory._session
master.session = downloader.session

# Set up master.get with remote's auth & proxy settings
master.get = partial(
master.get,
auth=downloader.auth,
proxy=downloader.proxy,
proxy_auth=downloader.proxy_auth,
)

deferred_download = self.remote.policy != Remote.IMMEDIATE
workers = self.remote.download_concurrency or self.remote.DEFAULT_DOWNLOAD_CONCURRENCY
Expand Down